Mohamed AbdelraZek
Mohamed AbdelraZek

Reputation: 2819

Adding a Commit to git while HEAD is not pointing to the last Commit ( Tip )

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)

Upvotes: 0

Views: 182

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 22047

# 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

Upvotes: 2

Related Questions