Skip to main content
The 2024 Developer Survey results are live! See the results
8 of 16
document and explain dangerous command
Cees Timmerman
  • 19.1k
  • 11
  • 95
  • 131

If there are no commits on the detached head, just do this:

git checkout master

Else save your commits on a new branch first:

git checkout -b temp
git branch -f master temp
git checkout master
Daniel Alexiuc
  • 13.2k
  • 9
  • 59
  • 73