christianmlong + git + alias   5

Easily checkout local copies of pull requests from remotes:
pr = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
pr-clean = "!git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
git  pull_request  pr  shell  alias 
september 2016 by christianmlong
command - Git alias with positional parameters - Stack Overflow
files = "!f() { git diff --name-status $1^ $1; }; f"
git  alias  shell  function 
march 2016 by christianmlong
In what cases could `git pull` be harmful? - Stack Overflow
However, with all versions of Git, I recommend configuring a git up alias like this:

git config --global alias.up '!git remote update -p; git merge --ff-only @{u}'

and using git up instead of git pull. I prefer this alias over git pull --ff-only because:

it works with all (non-ancient) versions of Git,
it fetches all upstream branches (not just the branch you're currently working on), and
it cleans out old origin/* branches that no longer exist upstream.
git  pull  up  alias  config  ff-only  merge 
july 2015 by christianmlong
Everyday Git Aliases
git lg
alias for git log ––pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'

When I'm viewing history I just want to see the SHA, the commit message, who made the commit and how long ago.
git  alias 
april 2015 by christianmlong

Copy this bookmark: