git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git pull --rebase with strategy ours doesn't work (possibly bug)
@ 2011-06-13  3:05 Dmitry S. Kravtsov
  2011-06-13  3:21 ` Dmitry S. Kravtsov
  2011-06-13 15:01 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry S. Kravtsov @ 2011-06-13  3:05 UTC (permalink / raw)
  To: git

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@example.com>
Date:   Mon Jun 13 13:53:27 2011 +1100

    2nd

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

    1st

Am I wrong at something?

-- 
Dmitry S. Kravtsov

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-06-13 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-13  3:05 Git pull --rebase with strategy ours doesn't work (possibly bug) Dmitry S. Kravtsov
2011-06-13  3:21 ` Dmitry S. Kravtsov
2011-06-13  3:41   ` Dmitry S. Kravtsov
2011-06-13  3:50     ` Dmitry S. Kravtsov
2011-06-13 15:01 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).