Skip to content

Instantly share code, notes, and snippets.

@simonc
Last active July 9, 2020 23:41
Show Gist options
  • Save simonc/4755949 to your computer and use it in GitHub Desktop.
Save simonc/4755949 to your computer and use it in GitHub Desktop.
My git configuration
[advice]
# Hides command hints in basic `git status`.
statusHints = false
# Hides any warning when checking out a commit by hash instead of branch.
detachedHead = false
[alias]
# Shows the commit hash on 6 chars to match `git log`.
# -s suppresses the author name and timestamp from the output.
blame = blame --abbrev=6 -s
br = branch
# Shows the changes added to the index.
dc = diff --cached
# Useful when using `hub` for Github.
pr = pull-request
rb = rebase
# -s gives the output in the short-format.
# -b shows the branch and tracking info even in short-format.
st = status -sb
# Amends the last commit, reusing the commit message.
cam = commit --amend --reuse-message=HEAD
# Saves all changes to the stash, including the untracked files.
sta = stash save -u
# Shows the log message of the last commit.
last = log -1
# Displays the git log of all branches as a tree.
tree = log --graph --all
# Displays the git log of all branches as a tree, except for the origin/gh-pages branch.
tree-static = log --graph --all --not origin/gh-pages
# Removes changes added in the index to the workspace.
# Not using `git restore --staged` as it requires explicit paths to be provided.
unstage = reset HEAD --
[branch]
# https://git-scm.com/docs/git-config#Documentation/git-config.txt-branchautoSetupMerge
autoSetupMerge = true
[color]
# Activates colored output.
ui = true
[core]
editor = code --wait
# Uses ~/.gitignore as global ignore list.
excludesfile = ~/.gitignore
[credential]
helper = osxkeychain
[diff]
# Hides source and destination prefixes in `git diff` (the a/ and b/ in front of filenames).
noprefix = true
# Specifies the format in which differences in submodules are shown.
# The "log" format lists the commits in the range.
submodule = log
[format]
# Pretty log format for `git log` and `git tree`.
# %h: abbreviated commit hash
# %ad: author date (format respects --date= option)
# %s: subject (commit message)
# %an: author name
# %d: ref names (HEAD, branches, tags)
# see https://git-scm.com/docs/git-log for more placeholders.
pretty = "format:%C(red)%h%C(reset) - %C(blue)(%ad)%Creset %C(italic)%s%Creset %C(green)%an%C(reset) %C(yellow)%d%C(reset)"
[help]
# Automatically corrects and executes mistyped commands.
autocorrect = 1
[http]
# Does not verify the SSL certificate when fetching or pushing over HTTPS.
sslVerify = false
[log]
# Formats the data in git log as 2042-12-28 12:34.
date = "format:%Y-%m-%d %H:%M"
[pull]
# Rebases branches on top of the fetched branch, instead of merging the default branch from
# the default remote when "git pull" is run.
rebase = true
[rebase]
# When the commit log message begins with "squash! xxx" (or "fixup! xxx"), and there is already
# a commit in the todo list that matches the same xxx, automatically modifies the todo list of
# `rebase -i` so that the commit marked for squashing comes right after the commit to be modified,
# and changes the action of the moved commit from `pick` to `squash` (or `fixup`).
# A commit matches the xxx if the commit subject matches, or if the xxx refers to the commit's hash.
# As a fall-back, partial matches of the commit subject work, too.
autosquash = true
# Automatically creates a temporary stash entry before the rebase begins
# and applies it after the rebase ends.
autostash = true
[rerere]
# Activates recording of resolved conflicts, so that identical conflict hunks can be resolved
# automatically, should they be encountered again.
enabled = 1
[status]
# Shows a summary of commits for modified submodules in `git diff`.
submoduleSummary = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment