git - HEAD~ for a merge commit -


in git, can refer commit before head using shorthand head~, , 2 before using head~2, etc.

i have repository has merge commit following:

a----b-------------f       \           /        c----d----e 

head = f, head~ points b, , head~2 points a. merge commit this, there shorthand point e?

yes; ~ specifies generation, but can use ^ specify parent number, in case of merge.

git show head^2 

will show 2nd parent.

(the distinction subtle since without numeric argument both ~ , ^ show same thing, first parent of head. because both ~ , ^ default 1 without numeric parameter. show first parent (by depth) , first parent (by breadth) of course same.)


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -