Re: Teach git-gui about merging around modified files?

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

 



"Shawn O. Pearce" <spearce@xxxxxxxxxxx> wrote:
> Brian Downing <bdowning@xxxxxxxxx> wrote:
> > "git merge" will happily merge a change with modified files in the tree
> > as long as the merge doesn't touch any of them.  However, it appears
> > "git gui" won't even try if there are modified files at all.
> 
> Yes.  That is actually intentional...
> 
> If you merge and get conflicts you cannot abort to your pre-merge
> state safely by just doing a `git reset --hard` (or git-gui's own
> builtin action that does the same) as you will toss your own not
> yet committed changes too.  You really need to save those changes
> off first.

I felt bad about my original response to this thread.  Telling a
user that their workflow is broken and should be changed is not
very nice, and not user friendly.

So I just spent a couple of hours trying to teach git-gui to first
save off your index and working directory, then run the merge, and
during abort let you restore things even if they weren't committed.

During testing I learned that you can't merge if you have any
staged but uncommitted changes.  If you try git-merge-recursive
just aborts and refuses to execute the merge, even if the file
paths aren't in conflict and won't require a file level merge.
The issue is the files are staged in the index and would commit
as part of the merge commit, rather than staying out until after,
so the merge driver is really doing the right thing here.

I'm still convinced that merging while you have uncommitted changes
in the working directory is really bad.  Its nearly impossible
to recover from a conflict and get back to pre-merge state, and
its also confusing to resolve conflicts because your unstaged but
modified files are still showing in the status.

I'm going to shelve this work until post 0.8.0 and try to rework
it using git-stash as part of git-gui 0.9.0.  Ideally you should
be able to stash your work before merging, and unstash after the
merge is complete.

-- 
Shawn.
-
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]

  Powered by Linux