git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* why is merging with unstaged changes allowed when rebasing is not?
@ 2011-03-04 16:32 Christian Halstrick
  2011-03-04 17:53 ` Junio C Hamano
  2011-03-07  2:38 ` Neal Kreitzinger
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Halstrick @ 2011-03-04 16:32 UTC (permalink / raw)
  To: git

Isn't it inconsistent that I can merge with unstaged changes in my
work-tree but not rebase? I agree that both should fail if the
operation would have to touch the file which has unstaged changes. But
if not - why don't we allow the rebase? (Is it just because we
technically do a "git reset --hard" during the rebase which fails on
unstaged changes?). Here is how tried it out:

git init
touch a b
git add a b
git commit -m initial
echo "a-master" >> a
git commit -a -m "modified a on master"
git checkout -b side HEAD~1
touch c
git add c
git commit -m "added c on side"
echo "b-side" >> b
# git rebase master -> would fail complaining about unstaged changes
# git merge master ->  would not fail

Even a 'git checkout master; git cherry-pick side' works well (but
updates the wrong branch)

Ciao
  Chris

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

* Re: why is merging with unstaged changes allowed when rebasing is not?
  2011-03-04 16:32 why is merging with unstaged changes allowed when rebasing is not? Christian Halstrick
@ 2011-03-04 17:53 ` Junio C Hamano
  2011-03-07  2:38 ` Neal Kreitzinger
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2011-03-04 17:53 UTC (permalink / raw)
  To: Christian Halstrick; +Cc: git

Christian Halstrick <christian.halstrick@gmail.com> writes:

> Isn't it inconsistent that I can merge with unstaged changes in my
> work-tree but not rebase?

Because people who wrote rebase didn't bother; it is too cumbersome to
check all the possibly affected paths beforehand while replaying multiple
changes.

Patches welcome ;-).

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

* Re: why is merging with unstaged changes allowed when rebasing is not?
  2011-03-04 16:32 why is merging with unstaged changes allowed when rebasing is not? Christian Halstrick
  2011-03-04 17:53 ` Junio C Hamano
@ 2011-03-07  2:38 ` Neal Kreitzinger
  1 sibling, 0 replies; 3+ messages in thread
From: Neal Kreitzinger @ 2011-03-07  2:38 UTC (permalink / raw)
  To: Christian Halstrick; +Cc: git

On 3/4/2011 10:32 AM, Christian Halstrick wrote:
> Isn't it inconsistent that I can merge with unstaged changes in my
> work-tree but not rebase? I agree that both should fail if the
> operation would have to touch the file which has unstaged changes. But
> if not - why don't we allow the rebase? (Is it just because we
> technically do a "git reset --hard" during the rebase which fails on
> unstaged changes?). Here is how tried it out:
>
> git init
> touch a b
> git add a b
> git commit -m initial
> echo "a-master">>  a
> git commit -a -m "modified a on master"
> git checkout -b side HEAD~1
> touch c
> git add c
> git commit -m "added c on side"
> echo "b-side">>  b
> # git rebase master ->  would fail complaining about unstaged changes
> # git merge master ->   would not fail
>
> Even a 'git checkout master; git cherry-pick side' works well (but
> updates the wrong branch)
>
> Ciao
>    Chris

food for thought:

git-merge manpage: "Warning: Running git merge with uncommitted changes 
is discouraged: while possible, it leaves you in a state that is hard to 
back out of in the case of a conflict."

I would imagine that if its a bad idea for git-merge, its a really bad 
idea for git-rebase...

v/r,
neal

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

end of thread, other threads:[~2011-03-07  2:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04 16:32 why is merging with unstaged changes allowed when rebasing is not? Christian Halstrick
2011-03-04 17:53 ` Junio C Hamano
2011-03-07  2:38 ` Neal Kreitzinger

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).