Keeping your forked branch up to date (#6531)

* chore: updates to sync your forked ranch

* chore: use rease instead

* feat: update the script to not bomb out if you have added the remote before

* chore: add the comment back
This commit is contained in:
Ridhwana 2020-03-09 15:37:46 +02:00 committed by GitHub
parent 521cf57e63
commit 813389d36a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 2 deletions

View file

@ -50,6 +50,37 @@ git push origin master --force
This will overwrite the `master` branch of your fork.
## Keeping your branch up to date
Sometimes, your forked branch may get out of date. To get it up to date it,
carry out the following steps:
Rebase from upstream once again:
```shell
git checkout master
git pull --rebase upstream master
```
Checkout your feature branch locally and merge master back into your branch:
```shell
git checkout <feature-branch-name>
git merge master
```
Merge any conflicts in editor if necessary:
```shell
git commit -m "Fix merge conflicts"
```
Push the changes back to your origin feature branch:
```shell
git push origin <feature-branch-name>
```
## Additional resources
- [Syncing a fork](https://help.github.com/articles/syncing-a-fork/)

8
scripts/sync_fork.sh Normal file → Executable file
View file

@ -1,8 +1,12 @@
#!/bin/sh
set -e
# sync this fork with upstream to get the latest changes
git remote add upstream https://github.com/thepracticaldev/dev.to
URL="https://github.com/thepracticaldev/dev.to";
if ! git config remote.upstream.url > /dev/null; then
echo "Adding remote ${URL}"
git remote add upstream $URL
fi
git fetch upstream
git checkout master
git merge upstream/master