git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Commited to wrong branch

From
Howard Miller <howard@e-learndesign.co.uk>
Date
Sep 15, 2009, 10:31 UTC
Message-ID
<26ae428a0909150331q391ed39ak622902d175b46d84@mail.gmail.com>
Hi,

I am resurrecting a discussion from a week or two back (been on holiday). As follows...

I had made some changes to some files and then done a commit. Only then did I realise that I had the wrong branch checked out. To make matters worse I then did a 'git reset HEAD^' which means that I can now no longer switch branches. I am stuck. I had some advice (thanks!) but it was not complete. I'd appreciate some more help.

I was advised to do a 'git reflog --branchname--' (I don't know/understand what this command does) but it doesn't work. I just get 'usage: git reflog (expire | ...)'

So basically I am no further forward. Just to reiterate I need to...
* remove the commit from my current branch (it tracks a remote so I
would prefer there to be no evidence to confuse other people after I
push)
* add the changes to the (other) branch they should have been added to.
* not loose or break anything.
Any (more) help appreciated.
Next: Martin Langhoff
Message 1 of 20 in “Commited to wrong branch”
  1. Howard MillerSep 15, 2009
  2. Martin LanghoffSep 15, 2009
  3. Howard MillerSep 15, 2009
  4. Martin LanghoffSep 15, 2009
  5. Howard MillerSep 15, 2009
  6. Martin LanghoffSep 15, 2009
  7. Howard MillerSep 15, 2009
  8. Björn SteinbrinkSep 15, 2009
  9. Howard MillerSep 15, 2009
  10. Martin LanghoffSep 15, 2009
  11. Howard MillerSep 15, 2009
  12. Björn SteinbrinkSep 15, 2009
  13. Howard MillerSep 15, 2009
  14. Martin LanghoffSep 15, 2009
  15. Björn SteinbrinkSep 15, 2009
  16. Howard MillerSep 15, 2009
  17. Howard MillerSep 15, 2009
  18. Johannes SixtSep 15, 2009
  19. Martin LanghoffSep 15, 2009
  20. Björn SteinbrinkSep 15, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.