“This pull request contains merge conflicts that must be resolved.”

前端 未结 2 1175
离开以前
离开以前 2021-01-31 17:04

I\'m getting that error with a PR, but when I git status it says nothing to commit, working directory clean.

That\'s on the branch with the PR.

2条回答
  •  眼角桃花
    2021-01-31 17:59

    When I encountered this message, it was because my fork of a particular repo was behind the original. In my particular case the repo I'd forked is pydata/pandas.

    I had to configure a remote for my fork by doing:

    > git remote add upstream git@github.com:original_user/original_repo.git
    > git remote -v
    origin  git@github.com:some_user/pandas.git (fetch)
    origin  git@github.com:some_user/pandas.git (push)
    upstream    git@github.com:pydata/pandas.git (fetch)
    upstream    git@github.com:pydata/pandas.git (push)
    

    (Note: git remote add upstream is a git's way of saying "Add a remote called "upstream". The name can be anything.)

    Then I fetched the latest commits from the original repo with:

    > git fetch upstream
    > git checkout master # Just in case you're not already on master
    > git merge upstream/master
    

    and finally push the merged repo back to github:

    > git push
    

提交回复
热议问题