On Thu, 16 Nov 2006, Linus Torvalds wrote:Btw, the magic heads are probably not all that well documented. They do come up in the man-pages, but I don't think there is any central place talking about them. We have: - "HEAD" itself, which is obviously the default pointer for a lot of operations, and that specifies the current branch (ie it should currently always be a symref, although we've talked about relaxing that) - "ORIG_HEAD" is very useful indeed, and it's the head _before_ a merge (or some other operations, like "git rebase" and "git reset": think of it as a "original head before we did some uncontrolled operation where we otherwise can't use HEAD^ or similar") I use "gitk ORIG_HEAD.." a lot, and if I don't like something I see when I do it, I end up doing "git reset --hard ORIG_HEAD" to undo a pull I've done. This is important exactly because ORIG_HEAD is _not_ the same as the first parent of a merge, since a merge could have been just a fast-forward. - "FETCH_HEAD" as mentioned. Normally you'd only use this in scripting, I suspect, but it's potentially useful if you prefer to do a fetch first and then check out it (perhaps cherry-picking stuff instead of merging, for example). So you could do (for example) git fetch some-other-repo branch gitk ..FETCH_HEAD git cherry-pick <some-particular-commit-you-picked> - "MERGE_HEAD" is kind of the opposite of "ORIG_HEAD" when you're in the middle of a merge: it's the "other" branch that you're merging. It's mainly useful for merge resolution, ie git log -p HEAD...MERGE_HEAD -- some/file/with/conflicts is a great way to see what happened along both branches (note the _triple_ dot: it's a symmetric difference), to see _why_ the confict happened. Most of the above are used implicitly in various cases, not just HEAD. The "--merge" flag to git-rev-list (and thus git log and friends) is just shorthand for the above "HEAD...MERGE_HEAD" behaviour (with the addition of also limiting the result to just conflicting files), so git log -p --merge is basically exactly the same as the above (except for _all_ files that have conflicts in them rather than just one hand-specified one). Anyway, maybe somebody didn't know about these, and finds them useful. Normally, the only one you would _really_ use is "ORIG_HEAD" (which is described in several of the tutorials and examples, so people hopefully already know about it). Most of the others tend to mostly be used implicitly, not by explicitly naming them - although you _can_. 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
| Arjan van de Ven | [patch] Add basic sanity checks to the syscall execution patch |
| Andi Kleen | [PATCH CPA] [1/28] Shrink __PAGE_KERNEL/__PAGE_KERNEL_EXEC on non PAE kernels |
| Alex Dubov | Re: [2.6.20] tifm_7xx1/mmc not working |
| Jared Hulbert | [PATCH 00/10] AXFS: Advanced XIP filesystem |
git: | |
| Junio C Hamano | More precise tag following |
| walt | git versus CVS (versus bk) |
| Stephen R. van den Berg | RFC: grafts generalised |
| Pierre Habouzit | [PATCH 1/2] Add strbuf_cmp. |
| Richard Stallman | Real men don't attack straw men |
| K K | Re: No Blob without Puffy |
| Stephan A. Rickauer | Re: Net-SNMP segfaults under OpenBSD 4.3 |
| Brian A. Seklecki | sshd_config(5) PermitRootLogin yes |
| Jim Winstead Jr. | Re: Root Disk/Book Disk Compatibility |
| Howard Wei-Hao Pan | [Q] Does Linux work with PCMCIA devices? |
| Curtis Yarvin | Re: Problem with UNCOMPRESS |
| Ross Sponholtz | Re: S3 |
