今天打开以前的一个项目,其他同事在维护,自己想更新下最新代码,然后执行拉取了下,竟然报错了:
git pull origin master
From ssh://test.com:1198/~test/test
* branch master -> FETCH_HEAD
Auto-merging pom.xml
CONFLICT (content): Merge conflict in pom.xml
Auto-merging test-parent/pom.xml
CONFLICT (content): Merge conflict in test-parent/pom.xml
Removing test-stu/.gitignore
Auto-merging test-core/pom.xml
CONFLICT (content): Merge conflict in test-core/pom.xml
Automatic merge failed; fix conflicts and then commit the result.
然后clean了下:git clean -f
再次拉取依然报错
接着按照提示:git merge --abort
报错信息依旧
然后,查看了下状态
git status
On branch master
Your branch and 'origin/master' have diverged,and have 1 and 353 different commits each,respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit,working tree clean
由于之前本地修改过代码并提交过,且服务器上代码重构优化变动非常大,不想花时间处理冲突了,果断还原,还原方式如下:
1、> git rebase origin/master
Successfully rebased and updated refs/heads/master.
2、git pull --rebase
remote: Enumerating objects: 402,done.
remote: Counting objects: 100% (348/348),done.
remote: Compressing objects: 100% (187/187),done.
remote: Total 210 (delta 91),reused 0 (delta 0)
Receiving objects: 100% (210/210),20.74 KiB | 558.00 KiB/s,done.
Resolving deltas: 100% (91/91),completed with 28 local objects.
From ssh://test:1198/~test/test
* [new branch] 10.0.1.1 -> origin/10.0.1.1
* [new branch] 8.6.1.1 -> origin/8.6.1.1
* [new tag] 10.0.0.1 -> 10.0.0.1
* [new tag] 5.0.2.1 -> 5.0.2.1
Already up to date.
3、>git push origin master
Everything up-to-date
4、>git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit,working tree clean
原文地址:https://blog.csdn.net/thlzjfefe" target="_blank" rel="noopener" title="thlzjfefe">thlzjfefe</a> <img class="article-time-img article-heard-img" src="https://csdnimg.cn/release/blo
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。