Separate git configurations for file paths
In some situations it might be ideal to have differing git configs based on the working directory, for example if using the same machine for work and personal business. The git [include]
directive can automatically load configuration files based on simple conditionals. For example:
[include]
path = ~/.gitconfig.personal
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig.work
diff.noprefix true
Removes the a/
, b/
, etc. tags from diff related commands:
diff --git a/poem.txt b/poem.txt
index 269bd58..be8e407 100644
--- a/poem.txt
+++ b/poem.txt
@@ -3,3 +3,4 @@
He destroyed his cage
Yes
YES
The tiger is out
+
diff --git poem.txt poem.txt
index 269bd58..be8e407 100644
--- poem.txt
+++ poem.txt
@@ -3,3 +3,4 @@
He destroyed his cage
Yes
YES
The tiger is out
+
help.autocorrect [N]
Makes git automatically execute the suggested command when executing something with a spelling errors in it.
The argument N denotes tenths of seconds to wait.
$ git stats
git: 'stats' is not a git command. See 'git --help'.
The most similar command is
status
$ git stats
WARNING: You called a Git command named 'stats', which does not exist.
Continuing in 1.0 seconds, assuming that you meant 'status'.
On branch master
nothing to commit, working tree clean
log.abbrevCommit true
In case you do not use a custom log alias, it might be desirable to only show the first six characters of the commit hash in the log output.
commit 8bf0f88d5d57e55d6dd2d05e44f593ab62512b6b (HEAD -> master)
Author: Ava Yert
Date: Wed Mar 2 22:07:57 2022 +0200
Change config format to toml
commit 8bf0f88 (HEAD -> master)
Author: Ava Yert
Date: Wed Mar 2 22:07:57 2022 +0200
Change config format to toml
log.follow true
Adds the --follow
flag to log related commands, allowing one to view the history of a file across renames.
merge.conflictstyle diff3
In case of a merge conflict, in addition to showing our and their revisions, additionally shows the original revision.
<<<<<<< HEAD
host = localhost:8000
=======
host = localhost:8080
>>>>>>> incoming
password = password123
<<<<<<< HEAD
host = localhost:8000
||||||| 7276a9f
host = localhost
=======
host = localhost:8080
>>>>>>> incoming
password = password123
push.followTags true
Makes git push
push any tags in addition to commits.
rerere.enabled true
Turns on git rerere by default.
status.showUntrackedFiles all
Makes git recursively show untracked files within folders.
Untracked files:
(use "git add <file>..." to include in what will be committed)
test/
Untracked files:
(use "git add <file>..." to include in what will be committed)
test/code.py
test/secret.txt