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:
parent
521cf57e63
commit
813389d36a
2 changed files with 37 additions and 2 deletions
|
|
@ -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
8
scripts/sync_fork.sh
Normal file → Executable 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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue