Git Configuration - SeedCompany/cord-docs GitHub Wiki

Using Git Documentation

If you don’t want to apply these globally, then you can run those commands per project without the --global option.

# Identity
git config --global user.name <your name>
git config --global user.email <your email>

# We prefer rebasing over merging for short-lived branches
# Alias pull to rebase instead of merge
git config --global pull.rebase true

# Always make merge commits even if the branch can be fast-forwarded
# This keeps long-lived branches independent
git config --global merge.ff false

# Enable "reuse recorded resolution"
# so you don't have to fix the conflict multiple times.
git config --global rerere.enabled true

# will push the current branch to the remote one matching the same name
# regardless of whether the branch is tracking it or not
git config --global push.default current

# Remove remote branches locally if the remote has deleted them
git config --global remote.origin.prune true

# Automatically updates branches based on other branches when rebasing the branch closest to develop
git config --global rebase.updateRefs true

# Automatically squashes commits like "fixup! ..." and "squash! ..." when rebasing.
# This allows adjusting branch commits without having to do an interactive rebase.
git config --global rebase.autosquash true

Here are some other optional, more opinionated ones:

# Edit with VSCode
git config --global core.editor "code -w"

# Setup a global excludes file for non-project specific excludes. Like `.DS_STORE`
git config --global core.excludesfile = /Users/<yourNameHere>/.gitignore_global

# An aliased log command
git config --global alias.logline "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

# Turn off paging on branch & log lists
git config --global pager.branch false
git config --global pager.log false
⚠️ **GitHub.com Fallback** ⚠️