Bash: aliases to work with git upsteams.

This commit is contained in:
Artem Sapegin 2012-12-06 00:16:26 +04:00
parent 551c994416
commit b4de723f64
1 changed files with 22 additions and 0 deletions

View File

@ -147,6 +147,28 @@ function git-bitbucket() {
git push -u origin master
}
# Add remote upsteam
# USAGE: git-fork <original-author>
function git-fork() {
user=$1
if [[ "$user" == "" ]]
then
echo "Usage: git-fork <original-author>"
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