Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
git_revisions [2018/05/24 11:04] – [Basic Git revisions] rpjdaygit_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 repo).
  
 ===== Basic Git revisions ===== ===== Basic Git revisions =====
Line 19: Line 19:
 </code> </code>
  
-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):
  
 <code> <code>
 $ git show 0adb32858b0bddf4ada5f364a84ed60b196dbcda $ git show 0adb32858b0bddf4ada5f364a84ed60b196dbcda
 +$ git show 0adb32858b0
 </code> </code>
  
Line 33: Line 34:
 </code> </code>
  
-===== Ancestral Git revisions =====+===== Ancestral Git revisions/references =====
  
 Given any revision, you can refer to its (first) parent, or first grandparent, and so on: Given any revision, you can refer to its (first) parent, or first grandparent, and so on:
Line 45: Line 46:
 </code> </code>
  
-There's also the tilde notation for brevity:+There's also the //tilde// notation for brevity, so these are (ignoring intermediate merge commits) equivalent:
  
 <code> <code>
-$ git show v4.15~10      (v4.15's ancestor 10 generations back)+$ git show v4.16^^^ 
 +$ git show v4.16~3 
 +</code> 
 + 
 +Examples using ''git diff'': 
 + 
 +<code> 
 +$ git diff v4.16^^ v4.16^ 
 +$ git diff v4.16^ v4.16 
 +</code> 
 + 
 +===== Commits with more than one parent ===== 
 + 
 +First or second parent: 
 + 
 +<code> 
 +$ git show HEAD^ 
 +$ git show HEAD^2 
 +</code> 
 + 
 +Getting carried away: 
 + 
 +<code> 
 +$ git show v4.19^2~3^^
 </code> </code>
  • git_revisions.1527159897.txt.gz
  • Last modified: 2018/05/24 11:04
  • by rpjday