-2

I see some people using caret and tilda sign with HEAD like HEAD^ or HEAD~(NUMBER VALUE) which i dont understand properly.

  • Have you looked in the docs? Read e.g. https://stackoverflow.com/questions/26785118/head-vs-head-vs-head-also-known-as-tilde-vs-caret-vs-at-sign? – jonrsharpe Oct 16 '19 at 20:08

1 Answers1

0

From the rev-parse docs:

   <rev>^, e.g. HEAD^, v1.5.1^0
       A suffix ^ to a revision parameter means the first parent of that commit object.  ^<n> means the <n>th
       parent (i.e.  <rev>^ is equivalent to <rev>^1). As a special rule, <rev>^0 means the commit itself and
       is used when <rev> is the object name of a tag object that refers to a commit object.

   <rev>~<n>, e.g. master~3
       A suffix ~<n> to a revision parameter means the commit object that is the <n>th generation ancestor of
       the named commit object, following only the first parents. I.e.  <rev>~3 is equivalent to <rev>^^^ which
       is equivalent to <rev>^1^1^1. See below for an illustration of the usage of this form.
William Pursell
  • 204,365
  • 48
  • 270
  • 300