Git pull --rebase with strategy ours doesn't work (possibly bug)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

So here the steps to reproduce:

$ git init A
Initialized empty Git repository in /home/catsadmin/git-test/A/.git/
$ (cd A && echo 123 > file && git add file && git commit -m "1st")
[master (root-commit) 1055edf] 1st
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file
$ git clone A B
Cloning into B...
done.
$ git clone A C
Cloning into C...
done.
$ (cd B && echo 333 >file && git commit -am "2nd")
[master 4e9cd67] 2nd
 1 files changed, 1 insertions(+), 1 deletions(-)
$ (cd A && git pull ~/git-test/B master)
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
>From /home/catsadmin/git-test/B
 * branch            master     -> FETCH_HEAD
Updating 1055edf..4e9cd67
Fast-forward
 file |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
$ (cd C && echo 111 > file && git commit -am "3rd")
[master 1c4a368] 3rd
 1 files changed, 1 insertions(+), 1 deletions(-)
$ cd C
$ git push origin master
To /home/catsadmin/git-test/A
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '/home/catsadmin/git-test/A'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

So my idea is to create a straight line history, that will look like
"1st"---"2nd"---"3rd",
and from git-rebase man page I read, that strategy ours allows us to
discard conflicing changes in favor
of ours.

$ git pull --rebase -s ours origin master
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
>From /home/catsadmin/git-test/A
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Already applied: 0001 3rd
/usr/bin/git-rebase: line 157:
/home/catsadmin/git-test/C/.git/rebase-merge/rewritten: ÐÐÑ ÑÐÐÐÐÐ
ÑÐÐÐÐ ÐÐÐ ÐÐÑÐÐÐÐÐ
All done.

This message not only looks weird, it also discard my "3rd" commit
from master tree:
$ git branch
* master
$ git log
commit 4e9cd6730b1215b22b65fbcc6cbf87e331e5eb92
Author: Your Name <you@xxxxxxxxxxx>
Date:   Mon Jun 13 13:53:27 2011 +1100

    2nd

commit 1055edf3618787ea53231ed6f4b00dfe571c8940
Author: Your Name <you@xxxxxxxxxxx>
Date:   Mon Jun 13 13:52:53 2011 +1100

    1st

Am I wrong at something?

-- 
Dmitry S. Kravtsov
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]