Skip to main content
Handle merges. Link the docs.
Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

To check out the parent commit, run

git checkout HEAD~1

This can be repeated ad nauseam, until you reach the first commit.

If you need to explore different parents leading up to a merge, use ^ instead:

git checkout HEAD^2

will check out the second parent of the current merge commit.

See “Specifying revisions” in the git-rev-parse documentation for details.

To check out the parent commit, run

git checkout HEAD~1

This can be repeated ad nauseam, until you reach the first commit.

To check out the parent commit, run

git checkout HEAD~1

This can be repeated ad nauseam, until you reach the first commit.

If you need to explore different parents leading up to a merge, use ^ instead:

git checkout HEAD^2

will check out the second parent of the current merge commit.

See “Specifying revisions” in the git-rev-parse documentation for details.

Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

To check out the parent commit, run

git checkout HEAD~1

This can be repeated ad nauseam, until you reach the first commit.