Created
May 1, 2013 20:54
-
-
Save gilesbowkett/5498308 to your computer and use it in GitHub Desktop.
github help article implemented as shell script. is there an easier way?
This file contains hidden or 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
# based on the workflow from https://help.github.com/articles/syncing-a-fork | |
function fetch_remotes() { | |
for remote in $(echo $(git remote)) | |
do | |
git fetch $remote | |
done | |
} | |
function hub_sync() { | |
git co master && | |
fetch_remotes && | |
git merge upstream/master && | |
git push origin master && | |
git st | |
} | |
hub_sync |
and based on the assumption that you want to keep track of a lot of different stuff your team is doing
fetch_remotes
could be replaced with git fetch --all
, IIRC
I would also recommend using either git rebase upstream/master
instead of git merge
or adding the --ff-only
flag to the merge
command. This way your fork's history closely matches the upstream
. Otherwise your fork could begin to accumulate merge-commits.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
where
st
is an alias forstatus
, andco
forcheckout