diff --git a/docs/getting-started/syncing.md b/docs/getting-started/syncing.md index 45bf9f30e..4d1373609 100644 --- a/docs/getting-started/syncing.md +++ b/docs/getting-started/syncing.md @@ -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 +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 +``` + ## Additional resources - [Syncing a fork](https://help.github.com/articles/syncing-a-fork/) diff --git a/scripts/sync_fork.sh b/scripts/sync_fork.sh old mode 100644 new mode 100755 index 808003f01..6098a8857 --- a/scripts/sync_fork.sh +++ b/scripts/sync_fork.sh @@ -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 -