简体   繁体   中英

Change a git branch in accordance with a pull request's change request?

I have cloned a github repo to a local repo

git clone https://github.com/myOrganization/topOfRepo.git

I then created a branch from master, call it 'branch1' , and made some commits:

cd topOfRepo
git checkout -b branch1

echo "additional line of text" >> foo.txt

git commit -m "added text to end of file" foo.txt

These were then pushed to the github repo

git push --set-upstream origin branch1

I then submitted a pull request to merge the branch into master via the "New pull request" button in github.

The reviewer of the pull request added some "request changes" to the pull request:

request changes: Submit feedback that must be addressed before the pull request can be merged.

What is the standard method for acting on those request changes and providing my subsequent updates into the original pull request?

Possibilities I can think of, but don't know the consequences, are:

  1. Simply commit more changes to branch1 which will somehow make it into the pull request (possibly via another push)
  2. Branch off of branch1
  3. Create a new branch and new pull request

Thank you in advance for your consideration and response.

You should just be able to commit changes to your existing branch.

If you want these changes to look like part of the original commits you can use:

  1. git reset HEAD~n where n is the number of commits you want to take back.
  2. Make the changes then git commit -m "updating from feedback"
  3. git push origin branch1 --force-with-lease .

Otherwise just make new commits and push!

Either way works, it's really up to how clean your team keeps your pull requests/commit history.

Best git cheat sheet I know of -> https://github.com/k88hudson/git-flight-rules

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