From: David Kågedal Date: Fri, 14 Mar 2008 10:39:10 GMT Subject: Re: About detached heads Message-ID: <87iqzpfv3l.fsf@lysator.liu.se> In-Reply-To: <57518fd10803140251v425a0fa3ud11687a5043806cc@mail.gmail.com> "Jonathan del Strother" writes: > On Fri, Mar 14, 2008 at 9:46 AM, Geoff Russell > wrote: >> This should be simple! I have a series of commits: >> >> 1---2---3---4---5 >> >> I want to go back to 3 but not branch, so I want >> >> 1---2---3---4---5---3 >> >> ? >> >> git checkout 3... >> >> gets me the commit on a detached head, but I don't know how to put this back >> as the HEAD. > > > Two options. Either rewrite history, nuking commits 4 & 5 : > git reset --hard 3 > > or publicly reverse the changes introduced by 5 & 4 : > git revert 5 > git revert 4 The revert can be done by resetting to the tree in 3: git checkout 3 -- . git commit -m "reset to 3" -- David Kågedal