On Thursday, November 29, 2012 at 02:18 EST,
David <
retb...@gmail.com> wrote:
> All my commits(saved in local) disappeared after repo-sync. I dunno why,
> but I checked using "gitk"..and everything disappeared!
> How can I restore those things?
The problem is that you started working without creating a topic branch
with "repo start". If you don't do that, you'll be working on a detached
head and your changes won't be available after a sync.
To get your commits back, run "git reflog" to obtain the SHA-1 or
symbolic name of your most recent commit. It's probably the second line
of output (i.e. HEAD@{1}). Then you can run this to restore:
repo start mybranch .
git reset --hard HEAD@{1}
repo sync -l .
So, this creates a new topic branch, resets it back to the state where
it would've been prior to your last sync, and finally runs a local-only
sync that'll rebase the branch onto the current upstream tip.
[...]
--
Magnus Bäck
ba...@google.com