简体   繁体   中英

GitHub - Pull Request - Merges

I am using the GitHub web site to submit a pull request (eg development-Feature -> development). There are some cases where there is a conflict and it tell me that it can't automatically merge and to run the following command:

git checkout development
git merge development-Feature
git push origin development

When I run this command locally I get:

merge made by the 'recursive' strategy

Locally it does NOT have any conflicts (it automatically merged my conflicting files).

My question is, does GitHub (the web site) check for ANY conflicts (even if they can be auto merged) and just give up if there are any? I tried to find out what commands GitHub uses when doing a pull request but I can't seem to find it.

Thanks,

You're doing it the opposite way. You should merge the developement in your feature branch.

Your local copy of branch development is still in the "old" version. You have to update it manually.

if you type git fetch -p , from any branch, it will download from the server the "metadata" about the branches, so in other words, your local git will be able to know that you are not updated with the latest version. The -p argument will erase metadata from your local computer for branches that are no longer on github.

Now after doing the fetch command, you can checkout your development branch, and you should see a message that you are "behind".

Now you need to type git pull origin development (while being on the development branch) to actually get the data from the server.

Come back to your feature branch, and do a git merge development . You will get the conflicts that github is talking about. Fix them, commit, and push. Github will then allow you to merge

tl;dr

  1. git checkout development
  2. git pull origin development
  3. git checkout development-Feature
  4. git merge development
  5. Resolve conflicts manually
  6. git commit
  7. git push origin development-Feature

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM