From b4de723f64dc077f2b18eff843c94265569ca8d8 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Thu, 6 Dec 2012 00:16:26 +0400 Subject: [PATCH] Bash: aliases to work with git upsteams. --- includes/bash_functions.bash | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/includes/bash_functions.bash b/includes/bash_functions.bash index 5db1e63..d02173e 100644 --- a/includes/bash_functions.bash +++ b/includes/bash_functions.bash @@ -147,6 +147,28 @@ function git-bitbucket() { git push -u origin master } +# Add remote upsteam +# USAGE: git-fork +function git-fork() { + user=$1 + if [[ "$user" == "" ]] + then + echo "Usage: git-fork " + else + repo=`basename "$(pwd)"` + git remote add upstream "https://github.com/$user/$repo.git" + fi +} + +# Sync branch with upstream +# USAGE: git-upstream [branch] +function git-upstream() { + branch=${1-master} + git fetch upstream + git co origin $branch + git merge upstream/$branch +} + # Install/update all NPM tasks used in grunt.js in current folder function npm-grunt() { if [ ! -f "grunt.js" ]; then