login
Header Space

 
 

A note on merging conflicts..

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Git Mailing List <git@...>, Junio C Hamano <junkio@...>
Date: Friday, June 30, 2006 - 10:44 pm

Ok, over the last week or so, I've been having a lot more content 
conflicts than usual, mostly because of 

 (a) just the fact that the way the merge window happens for the kernel 
     these days, rather than have incremental small merges, we often end 
     up having lots of big ones.
and

 (b) I ended up merging a few trees that had lots of small changes all 
     over, notably to header files having their <config.h> include 
     removed, causing trivial conflicts.

Now, the good news is that I have to say that our conflict resolution 
rocks. It's all been _very_ easy to do. In fact, it's been even more 
pleasant than BK was, because of one big issue: you could resolve the 
conflict in the tree, then _test_ it (perhaps just compile-test it), and 
commit the resolved result separately. With BK, you had to resolve and 
commit atomically, and you never had access to a "preliminary resolve" to 
test.

However, I also notived one particular thing that I did that we make less 
than perfectly easy.

One thing that is _very_ useful to do is to do when you have a conflict is 
this:

	git log -p HEAD MERGE_BASE..MERGE_HEAD -- conflicting-filename

because this shows all the changes (with their explanations) for that 
filename since the MERGE_BASE in _both_ branches you're trying to merge. 
This simple command really makes conflict resolution a hell of a lot 
easier, because you can see what caused the conflict, and you get a real 
feel for what both branches were doing, making it a _lot_ more likely that 
you actually do the right thing.

Now, the downside is that the above is both a pain to type, and we don't 
actually even save the MERGE_BASE as a head, so you actually have to 
compute it yourself. It's easy enough to do:

	git-merge-base HEAD MERGE_HEAD > .git/MERGE_BASE

will do it, but the fact is, we should make this even easier.

In fact, after writing the above a few times, I really think there's a 
case for making a helper function that does exactly the above for us. 
Including all the "conflicting-filename" thing. It would be nice if

	git log -p --merge [[--] filenames...]

would basically expand to

	git log -p HEAD MERGE_HEAD
		^$(git-merge-base HEAD MERGE_HEAD)
		-- $(git-ls-files -u [filenames...])

so that I wouldn't have to type that by hand ever again, and doing a

	git log -p --merge drivers/

would automatically give me exactly that for all the unmerged files in 
drivers/.

Anybody want to try to make me happy, and learn some git internals at the 
same time?

			Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
A note on merging conflicts.., Linus Torvalds, (Fri Jun 30, 10:44 pm)
Re: A note on merging conflicts.., Junio C Hamano, (Fri Jun 30, 11:08 pm)
Re: A note on merging conflicts.., Linus Torvalds, (Fri Jun 30, 11:54 pm)
Re: A note on merging conflicts.., Rene Scharfe, (Sat Jul 1, 11:09 am)
Re: A note on merging conflicts.., Junio C Hamano, (Sat Jul 1, 2:37 pm)
Re: A note on merging conflicts.., Rene Scharfe, (Sat Jul 1, 3:29 pm)
Re: A note on merging conflicts.., Linus Torvalds, (Sat Jul 1, 4:04 pm)
Re: A note on merging conflicts.., Junio C Hamano, (Sat Jul 1, 4:07 pm)
Re: A note on merging conflicts.., Junio C Hamano, (Sat Jul 1, 4:14 pm)
Re: [PATCH 4/3] Fold get_merge_bases_clean() into get_merge_..., Johannes Schindelin, (Sun Jul 2, 5:56 am)
[PATCH 3/3] Make clear_commit_marks() clean harder, Rene Scharfe, (Sat Jul 1, 7:29 pm)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Junio C Hamano, (Mon Jul 3, 5:32 am)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Johannes Schindelin, (Mon Jul 3, 9:56 am)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Junio C Hamano, (Mon Jul 3, 3:47 pm)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Johannes Schindelin, (Mon Jul 3, 5:12 pm)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Linus Torvalds, (Mon Jul 3, 6:55 pm)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Johannes Schindelin, (Tue Jul 4, 3:53 am)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Junio C Hamano, (Tue Jul 4, 4:20 am)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Linus Torvalds, (Mon Jul 3, 1:05 pm)
Re: [PATCH 3/3] Make clear_commit_marks() clean harder, Johannes Schindelin, (Mon Jul 3, 5:08 pm)
[PATCH 2/3] Add '...' operator for revisions, Rene Scharfe, (Sat Jul 1, 7:29 pm)
[PATCH 1/3] Add get_merge_bases_clean(), Rene Scharfe, (Sat Jul 1, 7:29 pm)
Re: [PATCH 1/3] Add get_merge_bases_clean(), Johannes Schindelin, (Sat Jul 1, 7:43 pm)
Re: A note on merging conflicts.., Junio C Hamano, (Sat Jul 1, 3:56 pm)
Re: A note on merging conflicts.., Johannes Schindelin, (Sat Jul 1, 7:01 pm)
Re: A note on merging conflicts.., J. Bruce Fields, (Sat Jul 1, 2:01 pm)
Re: A note on merging conflicts.., Linus Torvalds, (Sat Jul 1, 2:20 pm)
Re: A note on merging conflicts.., Daniel Barkalow, (Sat Jul 1, 6:24 pm)
Re: A note on merging conflicts.., Linus Torvalds, (Sat Jul 1, 6:57 pm)
Re: A note on merging conflicts.., Daniel Barkalow, (Sat Jul 1, 7:25 pm)
Re: A note on merging conflicts.., Linus Torvalds, (Sat Jul 1, 8:08 pm)
Re: A note on merging conflicts.., Daniel Barkalow, (Sat Jul 1, 7:45 pm)
Re: A note on merging conflicts.., Rene Scharfe, (Sun Jul 2, 7:31 am)
Re: A note on merging conflicts.., Daniel Barkalow, (Sun Jul 2, 5:42 pm)
Re: A note on merging conflicts.., Linus Torvalds, (Sat Jul 1, 12:25 pm)
Re: A note on merging conflicts.., Rene Scharfe, (Sat Jul 1, 2:13 pm)
Re: A note on merging conflicts.., Johannes Schindelin, (Sat Jul 1, 11:23 am)
Re: A note on merging conflicts.., Linus Torvalds, (Fri Jun 30, 11:59 pm)
speck-geostationary