git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Dmitry S. Kravtsov" <idkravitz@gmail.com>
To: git@vger.kernel.org
Subject: Git pull --rebase with strategy ours doesn't work (possibly bug)
Date: Mon, 13 Jun 2011 14:05:31 +1100	[thread overview]
Message-ID: <BANLkTi=jLQf6Wp-qqYoy7kND2M1=WRyxXg@mail.gmail.com> (raw)

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

             reply	other threads:[~2011-06-13  3:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-13  3:05 Dmitry S. Kravtsov [this message]
2011-06-13  3:21 ` Git pull --rebase with strategy ours doesn't work (possibly bug) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTi=jLQf6Wp-qqYoy7kND2M1=WRyxXg@mail.gmail.com' \
    --to=idkravitz@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).