category | link | linkText | |||
---|---|---|---|---|---|
|
Git: Update a PR |
#Update a pull request
After somebody made a comment in your PR and asks you to fix it you may have to do the following:
If you are already in another branch you need to change back to the branch of the not approved PR. If you have already changed some files and if you want to save them to work on them later you may stash them:
$ git stash
Once you are in your branch that you need to fix you have to revert to the state BEFORE you committed your PR. Therefore you need the commit ID. You will get this ID with
$ git log --oneline
Use the ID that appears BEFORE your PR commit (the line BELOW your pr commit).
As an example we use the ID "1a9b7fe". We now need to revert to that ID:
$ git revert 1a9b7fe
Now we have reverted the commit and can work on it as if we would not have committed anything from our changes ;)
Well ... now do your fixes.
Once you are done you will need to commit your changes again.
After you committed please make sure (same also before ANY push) that you are on the latest changes. You do this with:
$ git fetch && git pull --rebase origin develop
If you have no merge conflicts you may push your changes to the repo, if not: FIX YOUR ISSUES FIRST!!!
If you have no (more) issues, you need to push your fixes back to the repo with:
$ git push origin YOUR_BRANCH_NAME --force
e.g.:
$ git push origin feat/BOSCH_1074_molecule_related_page_teaser_group --force
Now your old commit is deleted from the PR and replaced with your new commit.
YOU MUST NOT CREATE ANOTHER PR for the same branch ONCE A PR is already created!
Have fun!