1
0
forked from extern/nix-config

Change git aliases to abbreviations

Using abbreviations lets us take advantage of fish autocomplete and
helps us not forget the actual command being used.
This commit is contained in:
Donovan Glover 2018-09-19 16:22:19 -04:00
parent 7b2811d99b
commit 7525bd8220
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
3 changed files with 22 additions and 23 deletions

View File

@ -30,27 +30,6 @@ alias dog="pygmentize -g"
# Easily copy the contents of any file
alias copy="xclip -sel clip < "
####################################################################
# Git aliases
####################################################################
alias g="git" # In case we ever need to type a full command
alias ga="git add" # Swiftly add new files to the repository
alias gaa="git add --all" # Quickly add all the files changed in a repository
alias gap="git add --patch" # Commit a file one part at a time
alias gb="git branch --verbose" # Show a list of all the branches in the repository
alias gc="git commit -m" # Easily create new commits
alias gca="git commit --amend" # Easily amend previous commits
alias gd="git diff" # Show all file changes that you haven't added yet
alias gds="git diff --staged" # Show the changes you added but haven't committed yet
alias gg="git grep" # Easily grep for a string inside the git repository
alias gp="git push" # Push your commits to remote (usually origin)
alias gs="git status" # Compare any local changes you've made to the remote
alias gr="git reset HEAD~" # Undo the last commit but keep your changed files
alias gre="git remote --verbose" # Show all the remotes for the repository
alias grr="git reset --hard HEAD~" # Remove the last commit and all changes with it
alias gl="git lg" # Quickly show a list of the most recent commits
####################################################################
# Launch aliases (allow us to easily open external programs)
####################################################################

View File

@ -20,6 +20,28 @@ fish_default_key_bindings
# Source our aliases
source ~/.aliases.sh
if not set -q set_abbr
set -U set_abbr
abbr g "git"
abbr ga "git add"
abbr gaa "git add --all"
abbr gap "git add --patch"
abbr gb "git branch --verbose" # List all branches
abbr gc "git commit -m"
abbr gca "git commit --amend"
abbr gd "git diff" # Show all file changes not staged yet
abbr gds "git diff --staged" # Show changes staged but not committed
abbr gg "git grep"
abbr gl "git log --oneline --decorate --all --graph -n 10"
abbr gp "git push" # Push your commits to a remote server
abbr gs "git status -s"
abbr gss "git status"
abbr gr "git reset HEAD~" # Undo the last commit but keep changed files
abbr gre "git remote --verbose" # List all remotes
abbr grh "git reset head"
abbr grr "git reset --hard HEAD~" # Remove the last commit and all changes with it
end
# Start X at login
if status --is-login
if test -z "$DISPLAY" -a $XDG_VTNR = 1

View File

@ -27,8 +27,6 @@
ui = true
[alias]
s = status -s
lg = log --oneline --decorate --all --graph -n 10
contrib = shortlog -n -s
remotes = remote -v
praise = blame