Refer to previous Git commits

The ~(tilde) and ^(caret) symbols are used to point to a position relative to a specific commit. The symbols are used together with a commit reference, typically HEAD or a commit hash.

~<n> refers to the <n>th grandparent. HEAD~1 refers to the commit’s first parent. HEAD~2 refers to the first parent of the commit’s first parent.

^<n> refers to the the <n>th parent. HEAD^1 refers to the commit’s first parent. HEAD^2 refers to the commit’s second parent. A commit can have two parents in a merge commit.

Copied from: https://backlog.com/git-tutorial/using-branches/git-switch-branches/