What's the difference between HEAD^ and HEAD~ in Git?

前端 未结 16 1815
醉酒成梦
醉酒成梦 2020-11-22 10:43

When I specify an ancestor commit object in Git, I\'m confused between HEAD^ and HEAD~.

Both have a \"numbered\" version like HEAD^3<

16条回答
  •  伪装坚强ぢ
    2020-11-22 11:36

    • HEAD~ specifies the first parent on a "branch"

    • HEAD^ allows you to select a specific parent of the commit

    An Example:

    If you want to follow a side branch, you have to specify something like

    master~209^2~15
    

提交回复
热议问题