Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Badass git pull alias (up) to show commit log that just got pulled in addition to changes

Badass git pull alternative

Add this little snippet to your ~/.gitconfig and it amps up your git pull by means of git up

  1. Adds in a list of the commits you're pulling down
  2. Auto-prunes remote branches
  3. Defaults to pull --rebase - gets rid of unnecessary merge commits. If you don't know what rebase does, this is probably safe for you. If you know what rebase does, you should know where this will not be safe for you.

Scott Chacon and Ryan Tomayko basically figured out how to do this and I am stealing all of the credit.

[alias]
up = !sh -c 'git pull --rebase --prune && git log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}..'
main_site(mirroring) % git up
Updating 83856d9..3753172
Fast forward
app/controllers/repositories_controller.rb | 2 ++
app/views/repositories/new_mirror.html.erb | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
ryan@github.com - Handle creating mirror when mirror repo form submitted (2 days ago)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment