[core] # Speeds up `git status` by storing cache in the index. # nice: Works great on nixpkgs ✨ untrackedCache = true [help] autocorrect = immediate [init] defaultBranch = main [branch] # Show last committed branch first sort = -committerdate [tag] # Smart sort tags as versions (latest first) sort = -version:refname [status] # Show a line at the end of `git status` to say the number of stashes. # Useful since stashes are basically not discoverable otherwise. # (other than with my custom shell prompts) showstash = true [commit] # Always enable `--verbose` on commit/squash/... # (shows diff of what is being commited <3) verbose = true [push] # When `push` subcmd is called without a remote branch, # use the current local branch name as the remote branch name. # # GOTCHA: When the remote branch is different than local, `git push` will ignore it and push a new # branch with same name as local. default = current # When `--force-with-lease` is used, force an update only if the tip of the remote-tracking ref has been integrated locally. # (this is the safest force behavior, let's try!) useForceIfIncludes = true [pull] # Only allow fast-forward merge when using 'pull'. # => Non-ff merge is not attempted automatically and will need to be done manually. ff = only [merge] # When 'merge' subcmd is called without any ref, merge the upstream branch in. defaultToUpstream = true # Do not keep '.orig' files around after a merge conflict for that file, # (I can always find the original files with git!) keepBackup = false [rebase] # Automatically create a temporary stash entry before the operation begins, and apply it after the # operation ends. autostash = true # Automatically mark `fixup:` / `amend:` / `squash:` commits as `fixup` so they'll be auto # squashed into their respective commit. autosquash = true # Automatic rebase for stacked branches ✨ # REF: https://dev.to/onepoint/git-update-refs-in-a-nutshell-574c # # EXAMPLE: # For a feature split into 3 branches (stacked, to be merged in order): # (`first_branch` -> `intermediate_branch` -> `last_branch`) # After a required `fix typo` on the `first_branch`, # we can now `git switch last_branch; git rebase first_branch`, # 👉 The `intermediate_branch` will be auto-rebased on `first_branch` # and `last_branch` on the new `intermediate_branch` ✨ updateRefs = true # Print a warning when deleting commit lines in interactive rebase. # (use an explicit 'drop' action to avoid the warning) missingCommitsCheck = "warn" # Show a diffstat on successful rebase of the effective changes between the new root and HEAD stat = true [rerere] # Activate 'reuse recorded resolution' system, tracking before/after conflict resolution when they # happen and auto-resolve future similar ones. # Can be useful while doing git rebases, to auto-resolve conflicts I already fixed in the past. # # Ref: https://www.git-scm.com/book/en/v2/Git-Tools-Rerere enabled = true [diff] # Detect renames & copies (defaults to only renames) renames = copy # Use diff algorithm with better / more logical changes detection & clustering # REF: https://luppeng.wordpress.com/2020/10/10/when-to-use-each-of-the-git-diff-algorithms/ (with examples) # REF: https://stackoverflow.com/a/32367597/5655255 algorithm = histogram [fetch] # Auto remove any remote-tracking refs that no longer exist on the remote prune = true # Do NOT prune tags, otherwise it removes all tags when fetching in a repo with both upstream & fork remote: # - when fetching upstreams: there are tags # - when fetching my fork: there are no tags, removing all existing ones # (Can be nice to have in a work-specific config though!) # pruneTags = true # Always fetch all available remotes all = true # Writes the commit graph on fetch, takes a bit more time but significantly improves performance # of many Git commands that need to navigate the graph of commits (e.g. `git log --graph`). # ref: https://blog.gitbutler.com/git-tips-3-really-large-repositories/#commit-graph writeCommitGraph = true [blame] # The file where to look for low-signal large-changes revisions to ignore in `git blame` # This is a common convention now, but not the default (for backward compat) # REF: Https://www.perplexity.ai/search/git-blame-ignore-revs-B4FBGbCLQxqDQ1wGTLz8Yg # ignoreRevsFile = .git-blame-ignore-revs # NOTE: We cannot set this globally, or we get a hard error when the file is missing.. â˜šī¸ # ref: https://stackoverflow.com/q/70435937/5655255 # vim:set ft=gitconfig: