Posted By

kmorey on 02/17/10


Tagged

git


Versions (?)

recovering from git's (no branch)


 / Published in: Bash
 

  1. # if you have already checked out to master, you won't know the commit-ish of your "no branch":
  2. git fsck --lost-found # (to find your <commit-ish>)
  3. git merge <commit-ish>
  4.  
  5. # if you are still on your "no branch" commit:
  6. git log # (the commit-ish will be on the first line)
  7. git checkout master
  8. git merge <commit-ish>
  9.  
  10. # or
  11. git log | head -n 1 | cut -d ' ' -f 2 | pbcopy
  12. git checkout master
  13. git merge <commit-ish>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: sebicas on June 17, 2011

Thanks Kmorey! You saved my life! :)

You need to login to post a comment.