Skip to content
Browse files

Update 2012-12-31-git-cheat-sheet.markdown

  • Loading branch information...
1 parent 06bd017 commit c77835e2dcfc55533d40c447f581243bf3229f53 @namman committed Jun 1, 2013
Showing with 27 additions and 0 deletions.
  1. +27 −0 source/_posts/2012-12-31-git-cheat-sheet.markdown
View
27 source/_posts/2012-12-31-git-cheat-sheet.markdown
@@ -30,3 +30,30 @@ Pretty log
```
git log --graph --decorate --pretty=oneline --abbrev-commit master origin/master <any other branch names you want in log>
```
+
+Detached HEAD means the commit that is HEAD can't be referenced by other commits - you can never merge it.
+To check if it was caused by a partially completed rebase (which creates a detached HEAD):
+See if there is anything in:
+```
+.git/rebase-merge/
+```
+To confirm detached head:
+```
+git branch -a
+```
+
+Solution:
+* Make a temp branch from your branch with work you want to push
+* Merge that branch into the target branch (eg, master)
+* Delete the temp branch
+```
+git checkout -b temp
+# check your work is there
+git checkout master
+git merge temp
+git branch -d temp
+```
+
+
+
+

0 comments on commit c77835e

Please sign in to comment.
Something went wrong with that request. Please try again.