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
  • 291,719
  • 55
  • 540
  • 600
Mohamed AbdelraZek
  • 2,053
  • 3
  • 19
  • 32
  • 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
  • 17,132
  • 3
  • 30
  • 49