What git
aliases do you use? Why do you like them?
For further actions, you may consider blocking this person and/or reporting abuse
What git
aliases do you use? Why do you like them?
For further actions, you may consider blocking this person and/or reporting abuse
Latest comments (16)
Here are mine:
I used to love the alias's that ship with Oh-my-zsh, then I found magit
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
if you don't have anything, this would suffice alone. i always forget how to push my new branch to remote...
Here is my list of
git
aliasShorthand for using git (bash/zsh alias):
alias g=git
Undo the last commit:
undo = reset --soft HEAD^
Get a summary of commits since yesterday (useful during standups):
standup = !"git log --reverse --branches --since=$(if [[ "Mon" == "$(date +%a)" ]]; then echo "friday"; else echo "yesterday"; fi) --author=$(git config --get user.email) --format=format:'%C(cyan) %ad %C(yellow)%h %Creset %s %Cgreen%d' --date=local"
Push to origin:
pp = push origin
Force push to origin:
ppf = push origin --force-with-lease
Pretty log:
lol = log --pretty=format:"%C(yellow)%h\\ %Cblue%G?%Cred%d\\ %Creset%s%Cgreen\\ (%cr)%Cblue\\ [%cn]" --decorate --graph
one for lazy remote tracking of the current branch
My standard response:
The case against aliases
Ben Sinclair ・ Sep 3 '18 ・ 1 min read
This is a must have on my
.bashrc
:These are from the oh-my-zsh git plugin:
github.com/robbyrussell/oh-my-zsh/...
alias.hug merge --ff-only
ud = "!f() { git checkout develop && git pull origin develop; }; f"
lbranch = "!f() { git rev-parse --abbrev-ref @{-1}; }; f"
udrcb = "!f() { git ud && git checkout $(git lbranch) && git rebase develop; }; f"