• 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

    先这样~ 


    版权声明
    本文原创发表于 博客园,作者为 阿K .     本文欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则视为侵权。
    欢迎关注本人微信公众号:觉醒的码农,或者扫码进群:

  • 相关阅读:
    本机可以,服务器却不行
    学习摘录1Hello, World!
    钻石问题
    OPEN OFFICE使用技巧
    操作符的重载
    函数重载
    关于“结构”好别扭的一段话
    多重继承
    OPEN OFFICE操作技巧3
    70个现代风格的HTML5 WordPress主题网站
  • 原文地址:https://www.cnblogs.com/FlyAway2013/p/15067755.html
Copyright © 2020-2023  润新知