S.m.g. baquer
S.m.g. baquer

Reputation: 429

How to fix this in git "This branch is out-of-date with the base branch"?

I am working on a project and I made a PR to the project in github and now my PR says that

"This branch is out-of-date with the base branch , Merge the latest changes from master into this branch"

So which git command should I use in order to make my branch parallel to the master branch?

Upvotes: 36

Views: 86064

Answers (1)

Carlos Parra
Carlos Parra

Reputation: 1067

If you created the Pull Request from a branch in the same project repository, then:

  • make sure you've checked out your branch (the one from the PR): git checkout your-branch
  • with your branch checked out, you should do a git pull origin master
  • then git push origin your-branch to update the PR.

If you forked a repo, created a branch and submit the PR, follow these steps:

  • create a remote with the original project repo: git remote add upstream 'url.git.here'
  • make sure you've checked out your branch: git checkout your-branch
  • get the latest changes from the upstream to your-branch: git pull upstream master
  • after that, push the changes you've got from upstream: git push origin your-branch
  • finally, you can go to GitHub page to make sure no more out-of-date is blocking your PR.

After that, you should see that your PR is all good to be merge (after reviews is set).

Upvotes: 45

Related Questions