Skip to content

Instantly share code, notes, and snippets.

@danielestevez
Created November 24, 2011 10:46
Show Gist options
  • Save danielestevez/1391076 to your computer and use it in GitHub Desktop.
Save danielestevez/1391076 to your computer and use it in GitHub Desktop.
GIT Configurations: Alias to Push/Pull automatically on working branch, nice git log format #git
#include this in your .gitconfigure to perform a pull/push origin on the branch you are currently working
# avoids mistakes performing 'pull origin master' when you are in stable and so on
#
[alias]
# Pushes/pulls to/from remote branch with corresponding name
pl = !git pull origin $(git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,')
ps = !git push origin $(git symbolic-ref HEAD | sed -e 's,.*/\\(.*\\),\\1,')
# nice git log format
[format]
pretty=format:%C(yellow)%h%Creset -%C(red)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset
@ku1ik
Copy link

ku1ik commented Jul 30, 2012

Isn't git pull/push HEAD enough? Am I missing something?

@danielestevez
Copy link
Author

Git pull/push HEAD pushes a whole untracked branch to remote but this alias ps/pl pushes changes to checked out branches existing in remote, if i'm not wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment