3

I am using the GitHub web site to submit a pull request (e.g. 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,

1
  • You may want to change the question title to better describe your issue
    – Stevoisiak
    Commented May 8, 2017 at 23:11

1 Answer 1

1

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
5
  • Note that the OP needs to reset development to before the git merge performed in the question. Commented Sep 16, 2016 at 20:38
  • I understand that is the "standard" way of doing branching, but we do it a bit differently. We try to keep our feature branches as clean as possible. This way we can have a stable release branch at all times. For example, in the traditional method, if featureA and featureB get merged to development (reverse merged first), then we find out featureB has an issue our release is on hold until that is fixed. With our approach, we can deploy feature A at any time.
    – user472292
    Commented Sep 16, 2016 at 20:55
  • Aside from the "process" discussion, I was more curious as to how GitHub handles merges. Do you have any insight into that? My main question is why does my local git merge automatically, but GitHub does not?
    – user472292
    Commented Sep 16, 2016 at 20:56
  • @user472292 Your local git is just not up to date with the repo. It's not "automatic". Also, to answer your other question about a stable release branch, you'll need an extra branch... for releases ! Basically, you will have a release branch, development branch and a feature branch. nvie.com/posts/a-successful-git-branching-model
    – wsalame
    Commented Sep 19, 2016 at 18:57
  • @wsalame - We have a development, release and feature branches. The problem is we don't want to merge between trunks (development and release) as there is very often features that were merged into development that failed testing (and we don't want to hold up the release). Also, my local git is up to date (same as what is in origin). So my main question is why does my local git auto merge (using the recursive strategy), but GitHub (web site) does not.
    – user472292
    Commented Sep 19, 2016 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.