repo sync -c拉的代码
没有创建branch, git push的时候无法push
所以repo sync .了一下,commit 被丢弃了
从网上查找到方法git reflog
git reflog 是存储在本地的一份你所有HEAD(不同branch)操作序列。与git log区别,git log则是你当前branch的提交历史
b1693cd HEAD@{0}: commit: ver 7 fix eeprom access error
a2c0663 HEAD@{1}: commit: add eep rwtest
f73355c HEAD@{2}: commit: ver 6 add can
025cb76 HEAD@{3}: commit: fix security access error
007cb9b HEAD@{4}: commit: ver5 fix security access issue
c3f762c HEAD@{5}: checkout: moving from master to m1
3d082f5 HEAD@{6}: checkout: moving from m1 to master
c3f762c HEAD@{7}: commit: clr same code
5201754 HEAD@{8}: commit: fix factor error
290d70e HEAD@{9}: pull: Fast-forward
通过git reflog 拿到commit后,git show [commit id] 确认清楚后
切换到正确branch后执行git cherry-pick [commit id]
git show [commit id] > tt.patch 在正确的目录执行 patch -p 1 -i ./tt.patch