Reputation: 10159
Suppose I created a pull request on a new branch, then I need to push some additional updates in the same pull request on the same new remote branch, here are my operations, wondering if correct or any better solutions? Thanks.
git checkout -b newFooBranch
git add <name of file changed>
git commit -m 'add some initial changes'
git push origin newFooBranch
// make some changes
git add <name of same file changed>
git commit -m 'add some new changes on the same file'
git push origin newFooBranch
regards, Lin
Upvotes: 0
Views: 1288
Reputation: 2701
If the changes are related to the previous change, I would recommend rather using:
git add <some changes related to previous commit>
git commit --amend
This will just append the changes to the previous commit, that way you don't litter your branch with changesets that mean little on their own.
If you have already pushed commits that could have be rolled into one commit, use rebase
to either squash
or fix
your commits.
Upvotes: 1
Reputation: 461
@LinMa, You could add "-u" parameter to either of your commit commands, the command will become:
git push origin -u newFooBranch
The "-u" parameter tells git to track (connect) your current local "newFooBranch" to the "newFooBranch" on the remote server. You only need to push with "-u" once for every newly created branch.
Upvotes: 1