3 ms·
I use git so much that I made these aliases in zsh: alias g="git show" alias gh="git show HEAD" alias gs="git status" alias gl="git log" al
by adtac 8y ago
I use git so much that I made these aliases in zsh:
alias g="git show"
alias gh="git show HEAD"
alias gs="git status"
alias gl="git log"
alias gco="git checkout"
alias gd="git diff"
alias gbl="git branch -v"
alias gbd="git branch -D"
alias gri="git rebase --interactive"
alias grc="git rebase --continue"
alias gra="git rebase --abort"
alias gst="git stash"
alias gsta="git stash apply"
alias gx="gco -- \*; git reset HEAD \*"
alias gcp="git cherry-pick"
alias gcpc="git cherry-pick --continue"
alias gcpa="git cherry-pick --abort"
A few hundred instances of "gs" in my .zhistory :)
- ryannevius 8y agoI find that... alias glol="git log --oneline" ...comes in handy as well, and it's fun to type.
- RichardCA 8y agoTry this one sometime... alias lg = log --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%cd %<(20,trunc)%an %C(auto)%h%Creset%C(auto)%d%Creset %s'
- lloeki 8y agoI find my git graph, git save, and git lint (also, git fetch --prune but lo alias for that one) extremely useful. Aliases in my ~/.gitconfig: [alias] co = checkout cm = !git add -A && git commit br = branch ci = commit st = status unstage = reset HEAD -- recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)" overview = log --all --oneline --no-merges recap = !git log --all --oneline --no-merges --author=${1-$(git config user.email)} today = !git log --all --since=00:00:00 --oneline --no-merges --author=${1-$(git config user.email)} changelog = !git log --oneline --no-merges ${1-$(git describe --abbrev=0)}..HEAD upstream = !git log --oneline --no-merges HEAD..${1-$(git branch -lvv | perl -ne '/^\\*.*\\[(.*?)\\]/ and print "$1\n"')} local = !git log --oneline --no-merges ${1-$(git branch -lvv | perl -ne '/^\\*.*\\[(.*?)\\]/ and print "$1\n"')}..HEAD graph = log --oneline --graph --all --decorate --date=iso save = !git add -A && git commit -m 'SAVEPOINT' undo = reset HEAD~1 --mixed backup = !git push origin/backup/$(whoami)/$(git branch) lint = !git branch --merged | grep -v \"^\\s*master$\" | grep -v \"\\*\" | xargs -n 1 git branch -d
- kippfe 8y agoThanks for the tip.. :)
- klatys 8y agonice ones! couple from my bash_alias alias ..="cd .." alias ..2="cd ../.." # ... you get the idea, mine goes up to 5 function mkcd () { mkdir -p "$@" && eval cd "\"\$$#\""; } alias h="history|grep"
- bhrgunatha 8y agoThe oh-my-zsh git plugin [1] aliases have become second nature. No need to install oh-my-zsh you can just take the file or cherry pick (!) the useful ones. I may drop oh-my-zsh completely and just set up zsh with the small subset of plugins I use. [1] https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/git https://github.com/robbyrussell/oh-my-zsh/tree/master/plugin...
- brbrodude 8y agohahah I have gs and gb(branch), just because I'm just constantly typing them(sometimes for no reason at all), others I end up typing the full commands tho
- codetrotter 8y agoI’ve been using short aliases for my most frequently used git commands for a few years now. I can’t imagine not using aliases. alias st='git status' alias dp='git diff' alias di='git diff --cached' alias aa='git add -A' alias cm='git commit -m' alias pu='git push' Having these aliases of mine makes these actions something that you don’t need to spend any mental effort to perform at all. I highly recommend others to define aliases that make sense to them for the most used got commands. Mine are named the way they are because the two letter alias represents how I think of the action that the command performs: * st - status * dp - diff pending * di - diff * aa - add all * cm - commit If you define your aliases this way (speaking to the other readers of this thread, not the person I am replying to), you will find that the combinations become muscle memory quickly. Notice also that unlike a lot of other people including the person I am replying to, my aliases are not prefixed with “g”. Again this boils down to your personal way of thinking. I’ve used other version control systems before, switched to git several years ago, and use git pretty much exclusively. I am of course aware at all times that I am working with git, but at the same time when I think of actions to perform, I don’t think of them as “git this or that”, I only think of the “this or that” part. If that makes sense :P But yeah, find aliases that work and make sense for you.
- jakelazaroff 8y agoSCM Breeze has aliases like that, plus a bunch of other convenient things like numbered shortcuts for branches and files: https://github.com/scmbreeze/scm_breeze https://github.com/scmbreeze/scm_breeze
- janlaureys 8y agoI use of few of these as well as alias stage="git add -A && git status" alias unstage="git reset HEAD && git status"