I found myself wandering about detached from my head, fully committed. You don’t want to commit when detached from head, but I had.
I didn’t know how it happened, but there I was, headless. What a silly, silly git.
I reached out to a friendly spider and the answer was there in the web.
Before you wander back to your head, it is important to mount yourself to a branch, then you can use that branch to reattach your head quite easily.
Here is how the magic incantations go:
git checkout -b the_wanderer
git rebase master
git checkout master
git merge the_wanderer
git commit
I’ve tied the branch to where I am, then grabbed where I was and attached that, then bound everything back together.
Clear as mud? Already done git checkout master
? Check the spellbook that inspired me.
THANK YOU – U saved my day. I miss svn so much…..
I dunno – I have to use SVN for publishing Orbital Feed Reader to the wordpress plugin codex, but I use git almost exclusively. Get good at git – it does more than SVN does.
Thanks dude works fine with me
I use git daily, but I’ll be the first to admit that anything outside of the standard workflow alludes me.
I think what caused my issue is that the parent repo contained an old submodule reference (i.e. the submodule had been updated, but the parent hadn’t, so the reference was out of date). I’d pulled down the main repo and the submodule, and started working on the submodule as if it were the most up to date version. So I’d been working on an old version of the submodule – and when it came to committing my changes git literally lost its head.
Was quite a pain to sort but this post helped get through the most difficult bit!
Thanks :)
Hey Nathan! I’m so glad I could help!