0

By wrong, I checked out the master branch to a specific commit and added a new commit while Head is not pointing to the Tip (last commit) now I got a "detached head"

What does that mean? and How can I move that Commit to be the last commit (Tip)

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
Mohamed AbdelraZek
  • 2,503
  • 4
  • 25
  • 36
  • Possible duplicate of [How to reconcile detached head and origin/master? Already checked out old hash](https://stackoverflow.com/questions/48797325/how-to-reconcile-detached-head-and-origin-master-already-checked-out-old-hash) – phd Sep 18 '19 at 12:22

1 Answers1

2
# create a branch at the current commit
git branch temp

# get back on master
git checkout master

# bring the lost commit back
git merge temp
Romain Valeri
  • 19,645
  • 3
  • 36
  • 61