2

On Github, I wanted to make a change to a pull request.

1. git fetch origin
2. git checkout -b show-buttons origin/my-branch

Then I made some changes to files.

Now I want to add these files back to the pull request, and finish merging it with master and pushing it. What are the right next steps?

Here is what I was thinking:

3. git add .
4. git commit -m "Fixed some bugs on mypullrequest."
5. git merge master
6. git push origin master
Don P
  • 60,113
  • 114
  • 300
  • 432
  • You don't need to merge master into your branch - this would typically be done once your pull request has been reviewed and accepted. Make your changes locally, then push back upstream without the merge. – Luke Peterson Jul 18 '14 at 10:52
  • Interesting was just following github's instructions at the bottom of their pull request page "Use the command line to resolve conflicts before continuing". – Don P Jul 18 '14 at 10:54
  • Do you know the syntax for pushing back upstream? tried `git push origin/mypullrequestbranch mypullrequest branch` but got `fatal: 'origin/mypullrequestbranch' does not appear to be a git repository` – Don P Jul 18 '14 at 10:55
  • Ahh, apologies, in that case sounds like you have merge conflicts. – Luke Peterson Jul 18 '14 at 10:55
  • `git push` alone will push your current branch back up to origin. – Luke Peterson Jul 18 '14 at 10:56

1 Answers1

0

If you want to push any local branch to a remote branch where a pull request is in progress:

git push origin localBranch:remoteBranch

It is best to establish localBranch as tracking remoteBranch

git push origin -u localBranch:remoteBranch
# in your case, possibly:
git push origin -u show-buttons origin/my-branch

See more at "How can I push a local Git branch to a remote with a different name easily?".

If your master is up-to-date (compared to the master of the original upstream repo), then rebasing your local branch on top of it can be a good idea

git checkout show-buttons 
git rebase master

But then you will have to force the push:

git push -f origin -u show-buttons origin/my-branch
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250