Monday, March 29, 2010

resolving 'could not detach HEAD'


git rebase origin/master
First, rewinding head to replay your work on top of it...
could not detach HEAD


I'm sure there are a variety of reasons that this could occur, but here was mine. Usually I do some version of fetch/stash/rebase/unstash to get changes, but this time it wasn't working. Running with -v showed some new files were created, and apparently 'could not detach HEAD' translated to 'you already have an un-added/commited file in a spot that would have a file after this. I had been checking that a new file someone else was commiting would work, and left that file in my working tree. Since I didn't add it, it was not removed by my stashing, and git kindly (but unhelpfully) refused to clobber my existing file. Renaming the offending file to something else (could've removed it, but I wanted to do a diff afterwards) fixed the problem, rebase worked fine.

No comments: