Created
February 25, 2015 21:24
-
-
Save jefffis/a5536a7e4693eafbb9da to your computer and use it in GitHub Desktop.
Forked from https://gist.github.com/ryangreenberg/869658 to make it work with pulling from current branch
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
#!/bin/sh | |
# Shortcut for git pull origin [current_branch] | |
# Mnemonic: plb for "pull branch" | |
if git rev-parse --git-dir > /dev/null 2>&1 # Current directory is a git repository | |
then | |
# http://stackoverflow.com/questions/1593051/ | |
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || | |
branch_name="(unnamed branch)" # detached HEAD | |
branch_name=${branch_name##refs/heads/} | |
echo "git pull origin $branch_name" | |
git pull origin $branch_name "$@" | |
else | |
echo "Error: The current directory does not appear to be a git repository" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment