git rebase 竟然把我的修改復原了, 丟失了


git rebase 多次, 發現反而出了問題。

 

git rebase 

 

 

 

發現下面的錯誤(一開始沒有注意)。

14:10    Build completed successfully with 1 warning in 1 sec, 715 ms

14:14    Tests passed: 0

14:14    Tests passed: 0

14:14    Build completed successfully with 1 warning in 1 sec, 954 ms

14:34    All files are up-to-date

14:34    Loaded classes are up to date. Nothing to reload.

19:28    Build completed successfully with 83 warnings in 23 sec, 688 ms

19:28    Hot Swap failed.
            TestCMPP2xxEndPointClient.testCMPPEndpoint: add method not implemented
            TestCMPP2xxEndPointClient.testCMPPEndpoint: Operation not supported by VM
            TestSMGPEndPointClient.testSMGPEndpoint: changes to method modifiers not implemented
            TestSMGPEndPointClient.testSMGPEndpoint: Operation not supported by VM

19:28    Rebase Error
            cannot rebase: You have unstaged changes.
            additionally, your index contains uncommitted changes.
            Please commit or stash them.
            Show details in console

19:28    Local changes were not restored
            Before update your uncommitted changes were saved to shelf.
            Update is not complete, you have unresolved merges in your working tree
            Resolve conflicts, complete update and restore changes manually.

19:28    Update canceled

19:28    Tests passed: 0

19:28    Tests passed: 0

19:28    Rebase Error
            cannot rebase: You have unstaged changes.
            additionally, your index contains uncommitted changes.
            Please commit or stash them.
            Show details in console

19:28    Update canceled

19:28    Rebase Error
            cannot rebase: You have unstaged changes.
            additionally, your index contains uncommitted changes.
            Please commit or stash them.
            Show details in console

19:28    Update canceled

19:28    Error running 'umc-common [install]': No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.

19:50    IntelliJ IDEA 2021.1.3 available
            Update...

19:59    IntelliJ IDEA 2021.1.3 available
            Update...

19:59    Rebase Error
            cannot rebase: You have unstaged changes.
            additionally, your index contains uncommitted changes.
            Please commit or stash them.
            Show details in console

19:59    Local changes were not restored
            Before update your uncommitted changes were saved to shelf.
            Update is not complete, you have unresolved merges in your working tree
            Resolve conflicts, complete update and restore changes manually.

19:59    Update canceled

20:00    56 files updated in 27 commits
            View Commits

 

 

后面發現 某些東西被 rollback了! 我做的修改呢???  我的天啊, 竟然存在 External Change!!!  而我並沒有在外部對當前項目,做任何修改(難道誤操作) 。

 

 

 

 


后面發現也不是誤操作, 而是 git reabse 的特性, 從日志來看, 因為出現了Rebase Error, 導致了 Local changes were not restored, 進而“ changes were saved to shelf. Update is not complete, you have unresolved merges in your working tree Resolve conflicts, complete update and restore changes manually.” , 

09:58:50.225: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -- protocol
warning: adding embedded git repository: protocol
hint: You've added another git repository inside your current repository.
hint: Clones of the outer repository will not contain the contents of
hint: the embedded repository and will not know how to obtain it.
hint: If you meant to add a submodule, use:
hint: 
hint:     git submodule add <url> protocol
hint: 
hint: If you added this path by mistake, you can remove it from the
hint: index with:
hint: 
hint:     git rm --cached protocol
hint: 
hint: See "git help submodule" for more information.
19:28:17.677: [spgate-protocol] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune
19:28:18.497: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune
remote: Enumerating objects: 612, done.        
remote: Counting objects:   0% (1/539)           
remote: Counting objects:   1% (6/539)            
....
Resolving deltas: 100% (164/164), completed with 47 local objects. From http://192.169.2.234/umc-gw/umc-common 735c430..81ddbe0 dev -> origin/dev 19:28:20.170: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false merge origin/dev --ff-only error: Your local changes to the following files would be overwritten by merge: common/src/main/java/com/montnets/umc/common/sms/SmsUtils.java Please commit your changes or stash them before you merge. Aborting 19:28:20.901: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false restore --staged --worktree --source=HEAD -- common/src/main/java/com/montnets/umc/common/sms/SmsUtils.java common/src/main/java/com/montnets/umc/common/constant/StaticConstant.java 19:28:21.025: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false rebase origin/dev error: cannot rebase: You have unstaged changes. error: additionally, your index contains uncommitted changes. error: Please commit or stash them. 19:28:25.836: [spgate-protocol] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 19:28:26.713: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 19:28:28.277: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false rebase origin/dev error: cannot rebase: You have unstaged changes. error: additionally, your index contains uncommitted changes. error: Please commit or stash them. 19:28:32.597: [spgate-protocol] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 19:28:33.491: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 19:28:35.009: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false rebase origin/dev error: cannot rebase: You have unstaged changes. error: additionally, your index contains uncommitted changes. error: Please commit or stash them. 19:59:38.906: [spgate-protocol] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 19:59:39.710: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 19:59:40.822: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false merge origin/dev --ff-only error: Your local changes to the following files would be overwritten by merge: common/src/main/java/com/montnets/umc/common/sms/SmsUtils.java Please commit your changes or stash them before you merge. Aborting 19:59:41.468: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false restore --staged --worktree --source=HEAD -- common/src/main/java/com/montnets/umc/common/sms/SmsUtils.java 19:59:41.586: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false rebase origin/dev error: cannot rebase: You have unstaged changes. error: additionally, your index contains uncommitted changes. error: Please commit or stash them. 20:00:24.222: [spgate-protocol] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 20:00:25.112: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false fetch origin --recurse-submodules=no --progress --prune 20:00:26.562: [umc-common] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false merge origin/dev --no-stat -v

 

 

 

 

我的 文件恢復到了 clean 狀態, 所以我的未提交的修改也丟失了, 但是實際上也沒有丟失, 而是到了 shelf:

 

 

 

git rebase 不行 ,那就git merge 吧, 大不了出現沖突解決一下:

 

 

 

git merge 呢, 至少是可以把遠程的提交拉取下來。 git rebase 不會。

20:00 56 files updated in 27 commits
View Commits

 

先這樣~ 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM