git merge advice?
PHP中文网
PHP中文网 2017-05-17 10:03:11
0
5
770

I often find file conflicts when pulling code and need to merge them manually, but I don’t want to merge and want to use other people’s latest ones directly, so I just delete the conflicting files and then pull them again, but pull them like this unsuccessful. So I manually copied the file from other places to the corresponding directory, but it still shows that it needs to be merged. What should I do now? Or how to delete the current branch?

PHP中文网
PHP中文网

认证0级讲师

reply all(5)
刘奇

If you have entered a conflict state, git merge --abort aborts the merge first.

But I don’t want to merge, I want to use other people’s latest ones directly

If you don’t want to merge, then don’t merge (don’t use git merge or git pull). You can first git fetch to get the contents of the remote repository, and then git checkout to the remote branch (origin/master or the like).

If you want to permanently abandon your local modifications and use remote overrides, you can perform git reset --hard on the remote branch you want (such as origin/master) after fetch.

If you do not have your own commits locally and only have uncommitted modifications, you can use git checkout . && git clean -fd to discard these modifications, and then git pull to update.

Extended reading: ProGit Second Edition Chinese Version.

巴扎黑

git stash, 拉更新,然后 git stash drop

習慣沉默

The simpler and more crude way is to delete the whole thing and clone it again

曾经蜡笔没有小新

Delete the merged file directly, then git add, then git commit, then delete git checkout otherBranch, and then delete the previous branch git branch -D needMergeBranch

伊谢尔伦
git branch -D wyb_v5.4_20170505
git checkout - b wyb_v5.4_20170505 origin/intergration_5.4_20170419
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template