|
#!/bin/sh |
|
# SPDX-FileCopyrightText: 2020-2024, Rylie Pavlik |
|
# SPDX-License-Identifier: CC0-1.0 |
|
# Nothing sh-specific here, these work fine in pwsh as well |
|
|
|
### Aliases |
|
# Lots of people use these, and I guess I type them a lot... |
|
git config --global alias.ci commit |
|
git config --global alias.co checkout |
|
|
|
# Less common but I feel like this might be a helpful workflow improvement. |
|
git config --global alias.ff "merge --ff-only" |
|
|
|
# don't pull, git rup - updates all the remotes |
|
git config --global alias.rup "remote update --prune" |
|
|
|
# don't force-push, git pf for safety and to avoid losing work |
|
git config --global alias.pf "push --force-with-lease --force-if-includes" |
|
|
|
# sometimes --force-if-includes is annoying, so we have the old alias of pf here as pff |
|
# ("really force") |
|
git config --global alias.pff "push --force-with-lease" |
|
|
|
# Sometimes required when e.g. you used `glab mr checkout 42` |
|
git config --global alias.pfff "push --force" |
|
|
|
# Fixup a commit, by hash (middle click paste from gitk is handy) |
|
# Can specify partial commit message with ":/someregex" if you prefer, see |
|
# https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt-emlttextgtemegemfixnastybugem |
|
git config --global alias.fu "commit --fixup" |
|
|
|
# Speedy shortcuts for rebase, these are my primary tools... |
|
git config --global alias.rbi "rebase -i --autosquash" |
|
git config --global alias.rbc "rebase --continue" |
|
git config --global alias.rbs "rebase --skip" |
|
git config --global alias.rba "rebase --abort" |
|
|
|
# ASCII art logs - see http://blog.kfish.org/2010/04/git-lola.html |
|
git config --global alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit" |
|
git config --global alias.lola "log --graph --decorate --pretty=oneline --abbrev-commit --all" |
|
|
|
### Config for pretty logs |
|
git config --global color.branch auto |
|
git config --global color.diff auto |
|
git config --global color.interactive auto |
|
git config --global color.status auto |
|
|
|
### Other config |
|
# only allow fast-forward pulls: make any merges/rebases manual and explicit |
|
git config --global pull.ff only |
|
|
|
# see the diff in the commit message editor |
|
git config --global --bool commit.verbose true |
|
|
|
# fix the default branch name |
|
git config --global init.defaultBranch main |
|
|
|
# Default to updating intermediate branches for better stacked branch experience: |
|
# https://andrewlock.net/working-with-stacked-branches-in-git-is-easier-with-update-refs/ |
|
git config --global --bool rebase.updateRefs true |
|
|
|
# Default to sorting `git branch` in reverse order of commit date: |
|
# so branch with most recent commit date comes first, etc. |
|
# Yes, the - before committerdate is important: otherwise it shows |
|
# the oldest first. |
|
git config --global branch.sort -committerdate |
|
|
|
# Store repeated merge/rebase conflict resolutions |
|
git config --global --bool rerere.enabled true |
|
|
|
|
|
### Config that's new that I'm trying out |
|
|
|
# submodule related |
|
git config --global --bool status.submoduleSummary true |
|
git config --global diff.submodule log |
|
git config --global --bool submodule.recurse true |
|
|
|
### User Identity |
|
# Edit these before pasting! |
|
|
|
git config --global user.name "Rylie Pavlik" |
|
git config --global user.email "rylie.pavlik@collabora.com" |
|
# git config --global user.email "rylie@ryliepavlik.com" |
|
|
|
# Consider installing this interactive rebase tool: |
|
# https://gitrebasetool.mitmaro.ca/ |