Last active
August 29, 2015 14:17
-
-
Save neikeq/8c81fb4192cec759782e to your computer and use it in GitHub Desktop.
Synchronize the forked repo without removing the local changes nor pushing them to origin. This code assumes that the local changes are in the private-changes branch and that master does not have changes to commit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: git remote add neikeq https://github.com/neikeq/KicksEmu.git | |
:: Create a branch for our local changes if it does not exists | |
git checkout -b private-changes | |
:: Fetch the updates from neikeq | |
git fetch neikeq | |
:: Commit all the changes from private-changes branch and merge updates | |
git checkout private-changes | |
git add -u . | |
git status | |
git commit -m "Local changes..." | |
git merge neikeq/master | |
:: Merge updates to master and push it to the github forked repo | |
git checkout master | |
:: git reset --hard HEAD | |
git merge neikeq/master | |
git push -u origin master | |
:: Back to the branch with the local changes | |
git checkout private-changes | |
PAUSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git remote add upstream https://github.com/neikeq/KicksEmu.git | |
# Create a branch for our local changes if it does not exists | |
git checkout -b private-changes | |
# Fetch the updates from upstream | |
git fetch upstream | |
# Commit all the changes from private-changes branch and merge upstream | |
git checkout private-changes | |
git add -u . | |
git status | |
git commit -m "Local changes..." | |
git merge upstream/master | |
# Merge upstream to master and push it to the github forked repo | |
git checkout master | |
# git reset --hard HEAD | |
git merge upstream/master | |
git push -u origin master | |
# Back to the branch with the local changes | |
git checkout private-changes | |
read -n1 -r -p "Press any key to continue..." key |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment