Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_revisions [2018/05/24 11:01] – [Overview] rpjday | git_revisions [2019/03/18 11:45] (current) – [Commits with more than one parent] rpjday | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | A small sample of Git revisions; different ways to refer to commits (using Linux kernel source). | + | A small sample of Git revisions; different ways to refer to commits (using Linux kernel source |
| ===== Basic Git revisions ===== | ===== Basic Git revisions ===== | ||
| Line 19: | Line 19: | ||
| </ | </ | ||
| - | And of course you can always use the full commit ID: | + | And of course you can always use the full commit ID (or a sufficient prefix): |
| < | < | ||
| $ git show 0adb32858b0bddf4ada5f364a84ed60b196dbcda | $ git show 0adb32858b0bddf4ada5f364a84ed60b196dbcda | ||
| + | $ git show 0adb32858b0 | ||
| </ | </ | ||
| Line 31: | Line 32: | ||
| 3fb78e8be9d9428fbc4c016f8b031b01a6fdd63d | 3fb78e8be9d9428fbc4c016f8b031b01a6fdd63d | ||
| $ | $ | ||
| + | </ | ||
| + | |||
| + | ===== Ancestral Git revisions/ | ||
| + | |||
| + | Given any revision, you can refer to its (first) parent, or first grandparent, | ||
| + | |||
| + | < | ||
| + | $ git show HEAD | ||
| + | $ git show HEAD^ | ||
| + | $ git show HEAD^^ | ||
| + | $ git show master^ | ||
| + | $ git show v4.16^^^ | ||
| + | </ | ||
| + | |||
| + | There' | ||
| + | |||
| + | < | ||
| + | $ git show v4.16^^^ | ||
| + | $ git show v4.16~3 | ||
| + | </ | ||
| + | |||
| + | Examples using '' | ||
| + | |||
| + | < | ||
| + | $ git diff v4.16^^ v4.16^ | ||
| + | $ git diff v4.16^ v4.16 | ||
| + | </ | ||
| + | |||
| + | ===== Commits with more than one parent ===== | ||
| + | |||
| + | First or second parent: | ||
| + | |||
| + | < | ||
| + | $ git show HEAD^ | ||
| + | $ git show HEAD^2 | ||
| + | </ | ||
| + | |||
| + | Getting carried away: | ||
| + | |||
| + | < | ||
| + | $ git show v4.19^2~3^^ | ||
| </ | </ | ||