Skip to content

Instantly share code, notes, and snippets.

@sachsgit
Last active July 20, 2023 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sachsgit/7adb6756afae10e21adf8110675924fb to your computer and use it in GitHub Desktop.
Save sachsgit/7adb6756afae10e21adf8110675924fb to your computer and use it in GitHub Desktop.
Aliases for GIT Bash
#!/bin/bash
alias s.g='. $HOME/.git_aliases'
### Git Aliases
alias gA='echo $ git add -A; git add -A;'
alias gcb='git branch | grep "*" | cut -c3-'
alias gcm='echo $ git checkout master; git checkout master;'
alias gf='echo $ git fetch --all --prune; git fetch --all --prune;'
alias ggc='git gc --aggressive --prune=1w'
alias git.reset='git rm -fr --cached .;git add -A;git commit -m "Re-baseline for updated gitignore";git push;'
alias gp='echo $ git pull; git pull;'
alias gpom='git pull origin master'
alias gpu='echo $ git push; git push'
alias gpun='echo $ git push -u; git push -u'
alias gr='echo $ git remote update; git remote update;'
alias gs='echo $ git status;git status;'
alias gsa='. "$OneDrive/bin/Git_StatusAll.sh"'
### Git Functions
function gc {
cmt=$1
echo $ git commit -m \"${cmt}\" ;
git commit -m "${cmt}" ;
}
function gca {
cmt=$1
echo $ git commit -am \"${cmt}\" ;
git commit -am "${cmt}" ;
}
gacpu() {
msg=$1
gA
gc "$msg"
gpun
}
gacp() {
msg=$1
gA
gc "$msg"
gpu
}
gcpu() {
msg=$1
gca "$msg"
gpun
}
gcp() {
msg=$1
gca "$msg"
gpu
}
### Combined Aliases
alias gfp='gr gf gp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment