git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nazri Ramliy <ayiehere@gmail.com>
To: git@vger.kernel.org
Subject: Counter-intuitive results for git show and git checkout during rebase  with conflict.
Date: Mon, 23 Feb 2009 12:04:53 +0800	[thread overview]
Message-ID: <544dda350902222004v742a7175od19ac417f75ddd1a@mail.gmail.com> (raw)

The scenario: We have two branches, local and master, we are now on
branch local, and we would like to rebase local wrt master:

	% git rebase master
	conflictedfile: needs merge
	cannot rebase: you have unstaged changes

Obviously we have a conflict, here's the problem: these commands have
counter-intuitive effect (as oppose to during a git merge with
conflict):

  git show :2:conflictedfile  # shows content from master version
  git show :3:conflictedfile  # shows content from local version

  git checkout --ours conflictedfile   # gets content from master version
  git checkout --theirs conflictedfile # gets content from local version

I know why they are counter-intuitive - :2:, :3:, --ours and --theirs
are relative to the current <commit>, and during a conflict due to a
rebase, the current <commit> is some commit that leads to master,
which is not anywhere in the path that leads to local.

So in summary:

Fact 1:
  During a conflict due to a rebase, HEAD is a commit that leads to
  the other branch.

Fact 2:
  During a conflict due to a merge, HEAD is a commit that leads to the
  current branch.

(Please correct me if the two facts above are not true)

Technically there's nothing wrong with the behavior of the commands,
but wouldn't it be better if the arguments :2:conflictedfile and
:3:conflictedfile to git show and the options --ours and --theirs to
git checkout be made aware of the two facts above and do a more
intuitive action?

Or should this be left to a higher level tools to automatically detect
the reason of the conflict and adjust the arguments appropriately so
that the end results are intuitive for the user?

nazri.

             reply	other threads:[~2009-02-23  4:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-23  4:04 Nazri Ramliy [this message]
2009-02-23  7:16 ` Counter-intuitive results for git show and git checkout during rebase with conflict Jay Soffian

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=544dda350902222004v742a7175od19ac417f75ddd1a@mail.gmail.com \
    --to=ayiehere@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).