5 ms·
I have several git alias that I live by: ga = git add -A gc = git commit gcm = git commit -m gp = git push All of these are defined in my zshrc rather than
by _fat_santa 2y ago
I have several git alias that I live by:
ga = git add -A
gc = git commit
gcm = git commit -m
gp = git push
All of these are defined in my zshrc rather than doing it through git config.
- alhirzel 2y agoSame thing - I put them in my shell. Here is the list I use: alias ga="git add" alias gaw="git add -A && git diff --cached -w | git apply --cached -R" alias gb="git branch" alias gbl="git branch -l" alias gbD="git branch -D" alias gbu="git branch -u" alias gc="git commit" alias gca="git commit -a" alias gcaa="git commit -a --amend" alias gcam="git commit -a -m" alias gce="git commit -e" alias gcfu="git commit --fixup" alias gcm="git commit -m" alias gco="git checkout" alias gcob="git checkout -b" alias gcoB="git checkout -B" alias gcp="git cherry-pick" alias gcpc="git cherry-pick --continue" alias gd="git diff" alias gd^="git diff HEAD^ HEAD" alias gds="git diff --staged" alias gl="git lg" # TODO - make these options defaults for "git log" itself alias glg="git log --graph --decorate --all" # TODO - make these options defaults for "git log" itself alias gdc="git diff --cached" alias gpom="git push origin master" alias gr="git remote" alias gra="git rebase --abort" alias grb="git rebase --committer-date-is-author-date" alias grbom="grb --onto master" alias grbasi="git rebase --autosquash --interactive" alias grc="git rebase --continue" alias grs="git restore --staged" alias grv="git remote -v" alias grh="git reset --hard" alias grH="git reset HEAD" alias grH^="git reset HEAD^" alias gs="git status -sb" alias gsd="git stash drop" alias gsl="git stash list --date=relative" alias gsp="git stash pop" alias gss="git stash show" alias gst="git status" alias gstn="git status -uno" alias gsu="git standup" alias gforgotrecursive="git submodule update --init --recursive --remote"
- fracus 2y agoI would guess a list this long is self defeating. You wouldn't remember the ones you don't use often but would have a better chance remembering the full command because the language of the command is more intuitive.
- alhirzel 2y agoMemory is pretty weird with these - I find that my hands do most of the remembering, and my mind doesn't have to do much work. It must be a very individual thing - hope everyone is doing what works for them. And you're right that there's always a safe fallback to default commands. I will admit that seeing the list in its entirety when posting it, I was surprised at its length, but I estimate I use at least 50% of these often! Looking at the other posts in the thread, it looks like this set of aliases is very similar (maybe I should switch to cut some fat out of my dotfiles): https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Contents/Resources/Documents/index https://kapeli.com/cheat_sheets/Oh-My-Zsh_Git.docset/Content...
- fracus 2y ago> It must be a very individual thing I suppose that is true because I can't remember more than 3 of my shell git aliases but I'm the most basic git user you can get and I don't use them for work.
- joshka 2y agoI recall seeing a omz (IIRC) plugin that reminds you of aliases that match the commands that you just ran. I had this turned on, but it got too annoying :)
- lcall 2y agoI do similarly but my favorite git log ("gl") variant (in a bash script rather than an alias) is: set -eux git log --notes --decorate=full --source --stat --summary -C -M --pretty=fuller $*|less ...so that I can see if there was any revision to a commit after it was first committed, which files were changed and how much, and pass extra parameters if needed.