search

Home  >  Q&A  >  body text

git merge advice?

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中文网2756 days ago773

reply all(5)I'll reply

  • 怪我咯

    怪我咯2017-05-17 10:05:11

    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.

    reply
    0
  • 巴扎黑

    巴扎黑2017-05-17 10:05:11

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

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-17 10:05:11

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

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-17 10:05:11

    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

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-17 10:05:11

    git branch -D wyb_v5.4_20170505
    git checkout - b wyb_v5.4_20170505 origin/intergration_5.4_20170419

    reply
    0
  • Cancelreply