记录一次 git 操作
一、问题
git 撤销上次提交后修改文件,然后同步触发以下命令及报错(报错来源与git输出面板)
同步包含两步:
- pull
- push
git pull
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
此次合并未处理(变更记录未覆盖任何冲突处)
git pull
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
此次合并未处理干净(变更记录未完全覆盖所有冲突处)
git pull
error: Your local changes to the following files would be overwritten by merge:
path/file
Please commit your changes or stash them before you merge.
Aborting
此次拉取前未提交合并
git push
error: failed to push some refs to '...'
hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g.'git pull ...') before pushing again.
此次 push 之前未进行 pull
git reset --soft HEAD~
fatal: Cannot do a soft reset in the middle of a merge.
此命令适用于本地记录合并,对于以提交到远程的并不适用
二、解决
- git reset --merge
注:取消合并
- git rebase
注:将当前分支重新设置基线文章来源:https://www.toymoban.com/news/detail-607275.html
后续即可正常进行冲突合并以及代码同步文章来源地址https://www.toymoban.com/news/detail-607275.html
到了这里,关于【已解决】git 撤销上次提交后修改文件再次提交 触发:Cannot do a soft reset in the middle of a merge的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!