2016-02-19 202 views
0

我在一个名为auth+menus的功能分支中工作,下面是我需要帮助尝试从中恢复的事件和操作顺序。我担心我失去了我所有的工作,我希望我错了。Git rebase - 跳过恢复

git commit -m "code changes"

git commit -m "more changes"

git rebase -i HEAD~2

git checkout master

git pull upstream master

git checkout auth+menus

git rebase master

git rebase --continue单个冲突存在

git rebase --skip

git add --all

git commit -m "some of these files should have already been committed"

git push origin auth+menu

git push origin auth+menu -f因为我是个白痴...

我希望我没有完全失去前两次提交中的一切,我真的需要别人的帮助!有没有办法从这个恢复,并得到我原来的两个提交?

回答

3

不,你没有失去任何东西。做一个git reflog。你会看到类似的东西:

33103ca [email protected]{0}: commit: Using arguments on command line to specify revision ra 
46d9365 [email protected]{1}: commit: more changes 
1dfdc0d [email protected]{2}: commit: code changes 
31a16ad [email protected]{3}: merge test2: Merge made by the 'recursive' strategy. 
1dfdc0d [email protected]{4}: commit: . 
ddc65bf [email protected]{5}: checkout: moving from test2 to master 
236c36d [email protected]{6}: commit: . 
ddc65bf [email protected]{7}: checkout: moving from master to test2 
ddc65bf [email protected]{8}: commit: . 
be347db [email protected]{9}: checkout: moving from be347db616c39dadad59308bee5736e5614e7d61 

那么,它可能看起来不像那样,但关键是找到“commit:more changes”这一行。继续并标记该吸盘;在这种情况下,它将是git tag mytag [email protected]{1}。然后你可以在标签中合并,樱桃挑选它,或者其他任何东西。

+0

让我试试看,谢谢 –

+0

顺便说一句@DavidPine,一般来说你不想在'git push'中使用'-f'。如果你正在和其他人一起工作,它很少会按照你的想法去做。 –

+0

我遇到了'git tag'问题,它不喜欢这个''git tag safety HEAD @ {9}'“ –