Skip to content

Instantly share code, notes, and snippets.

@favio41
Last active March 14, 2023 08:36
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 favio41/31dc9e19faf074e126a8c9ff061b564a to your computer and use it in GitHub Desktop.
Save favio41/31dc9e19faf074e126a8c9ff061b564a to your computer and use it in GitHub Desktop.
Alias for .gitconfig
[alias]
ready = !"git fetch --all && git checkout develop && git pull --rebase && git fetch-main && git branch --no-color | grep -v main | grep -v develop | xargs -r git branch -D"
graph1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
graph2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
graph = !"git graph1"
fetch-develop = fetch origin develop:develop
fetch-master = fetch origin master:master
fetch-main = fetch origin main:main
amend = commit -a --amend
undo = reset --soft HEAD~1
ignored = git ls-files -v
forget = update-index --assume-unchanged
unforget = update-index --no-assume-unchanged
sync-branch = !git pull && git remote prune origin
tag-push = "!f(){ git push origin master --no-verify && git tag \"$1\" && git push --tag \"$1\"; };f"
amend-to = "!f() { SHA=`git rev-parse \"$1\"`; git commit --fixup \"$SHA\" && GIT_SEQUENCE_EDITOR=true git rebase --interactive --autosquash \"$SHA^\"; }; f"
up = pull --rebase --autostash
clean-branches = !"git fetch -p && for branch in $(git branch -vv | grep ': gone]' | awk '{print $1}'); do git branch -D $branch; done"
@favio41
Copy link
Author

favio41 commented Aug 12, 2019

Use git config --global --edit to edit the config file.

@favio41
Copy link
Author

favio41 commented Sep 6, 2019

You can also edit using: vim ~/.gitconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment