Last active
January 21, 2025 02:59
-
-
Save mkropat/473c5515477e2eb7e008 to your computer and use it in GitHub Desktop.
Sensible Git defaults
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config --global --replace-all --type=bool push.autoSetupRemote true | |
| git config --global --type=bool rebase.autoStash true | |
| git config --global --type=bool rebase.updateRefs true | |
| git config --global core.autocrlf input | |
| git config --global core.commentChar auto | |
| git config --global init.defaultBranch main | |
| git config --global pull.ff only | |
| git config --global oh-my-zsh.hide-info 1 | |
| git config --global alias.ca 'commit --amend --no-edit' | |
| git config --global alias.ci 'commit --verbose' | |
| git config --global alias.dc 'diff --cached' | |
| git config --global alias.di diff | |
| git config --global alias.fp 'push --force-with-lease' | |
| git config --global alias.fpstack "\!git log --decorate=short --pretty='format:%D' origin/main.. | sed 's/, /\\n/g; s/HEAD -> //' | grep -Ev '/|^$' | xargs git push --force-with-lease origin" | |
| git config --global alias.l 'log --oneline' | |
| git config --global alias.pullrb 'pull --rebase' | |
| git config --global alias.rb '!f() { if [ $# -eq 0 ]; then set -- origin/main; git fetch origin main; fi && git rebase "$@"; }; f' | |
| git config --global alias.rc 'rebase --continue' | |
| git config --global alias.ri '!f() { if [ $# -eq 0 ]; then set -- origin/main; fi; git rebase --interactive --keep-base "$@"; }; f' | |
| git config --global alias.st 'status --short' | |
| git config --global alias.sw '! | |
| f() { | |
| if [ $# -gt 0 ]; then | |
| git switch "$@" | |
| else | |
| git branch --color=always --sort=-committerdate | | |
| fzf \ | |
| --ansi \ | |
| --bind enter:accept-or-print-query \ | |
| --height=~40% \ | |
| --preview="git log --color=always --oneline main...{1}" | | |
| xargs git switch | |
| fi | |
| }; f' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment