Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created August 26, 2021 16:12
Show Gist options
  • Save n8finch/4745d2d6a9ad1dbddcbdf5e55a69099f to your computer and use it in GitHub Desktop.
Save n8finch/4745d2d6a9ad1dbddcbdf5e55a69099f to your computer and use it in GitHub Desktop.
#############################
# GIT STUFFS
#############################
alias gits="git status"
alias gita="git add ."
alias gitap="git add -p"
alias gitco="git checkout"
alias gitcop="git checkout @{-1}"
alias gitcob="git checkout -b"
alias gitmprev="git merge @{-1}"
alias gitprettylog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
alias gitnah="git reset --hard"
alias gitdep="git checkout develop; gitmprev; gitpo; gitcop;"
gitc () {
git commit -m"$1"
}
gitcc () {
BRANCH=$(git branch --show-current)
# Which follows this syntax: string/pattern/replacement/global
# 's/\//(/g' looks for all occurances of `/` and replaces with (
# 's/-ABC-[0-9]\{4,\}/): $1/g' looks for all occurances of `-ABC-` appended with 4 or more digits and replace them with `: string-passed-in`
echo $BRANCH | sed -e 's/\//(/g' -e "s/-ABC-[0-9]\{4,\}/): $1/g"
MESSAGE=`echo $BRANCH | sed -e 's/\//(/g' -e "s/-ABC-[0-9]\{4,\}/): $1/g"`
git commit -m"$MESSAGE"
}
gitpo () {
BRANCH=$(git branch --show-current)
git push origin $BRANCH
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment