---
title: The git config Defaults Worth Overriding
description: A few git config defaults are just wrong for modern work. These one-liners fix branch sorting, new-branch pushes, diffs and command typos.
canonical: https://lukeocodes.dev/git-config-defaults
type: article
locale: en_GB
published: 2026-09-12T00:00:00.000Z
modified: 2026-09-12T00:00:00.000Z
authors:
  - Luke Oliff
section: Git
tags:
  - Git
  - TIL
  - gitconfig
  - cli
  - diff
  - rebase
feed: https://lukeocodes.dev/rss.xml
search: https://lukeocodes.dev/search.json?q={query}
schema:
  - "@context": https://schema.org
    "@graph":
      - "@type": WebSite
        "@id": https://lukeocodes.dev/#website
        url: https://lukeocodes.dev
        name: Luke Oliff
        alternateName: lukeocodes
        inLanguage: en
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
        description: Personal blog and writing by Luke Oliff — developer relations, voice AI, developer experience.
        potentialAction:
          - "@type": SearchAction
            target:
              "@type": EntryPoint
              urlTemplate: https://lukeocodes.dev/blog/search?q={search_term_string}
            query-input: required name=search_term_string
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Engineer and developer relations leader. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Engineer and developer relations leader
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
  - "@context": https://schema.org
    "@graph":
      - "@type": Person
        "@id": https://lukeocodes.dev/authors/luke#person
        name: Luke Oliff
        url: https://lukeocodes.dev/authors/luke
        description: Engineer and developer relations leader. Writing about developer relations, AI, and the voice industry, from the UK.
        mainEntityOfPage: https://lukeocodes.dev/authors/luke
        givenName: Luke
        familyName: Oliff
        image: https://lukeocodes.dev/authors/luke.jpg
        jobTitle: Engineer and developer relations leader
        sameAs:
          - https://www.linkedin.com/in/lukeocodes
          - https://github.com/lukeocodes
          - https://bsky.app/profile/lukeocodes.dev
          - https://x.com/lukeocodes
          - https://hashnode.com/@lukeocodes
          - https://dev.to/lukeocodes
        knowsAbout:
          - Developer Relations
          - Developer Experience
          - Voice AI
          - Text-to-Speech
          - Answer Engine Optimisation
          - Search Engine Optimisation
          - Open Source
          - Developer Tooling
          - API Design
          - Speech-to-Text
          - Voice Agents
          - Community Building
        knowsLanguage:
          - English
        nationality: British
        alumniOf:
          - "@type": Organization
            name: The Open University
      - "@type": BlogPosting
        "@id": https://lukeocodes.dev/git-config-defaults#article
        headline: The git config Defaults Worth Overriding
        alternativeHeadline: The git config Defaults Worth Overriding
        description: A few git config defaults are just wrong for modern work. These one-liners fix branch sorting, new-branch pushes, diffs and command typos.
        datePublished: 2026-09-12T00:00:00.000Z
        dateModified: 2026-09-12T00:00:00.000Z
        url: https://lukeocodes.dev/git-config-defaults
        mainEntityOfPage: https://lukeocodes.dev/git-config-defaults
        inLanguage: en
        author:
          - "@id": https://lukeocodes.dev/authors/luke#person
        isPartOf:
          "@id": https://lukeocodes.dev/#website
        keywords: Git, TIL, gitconfig, cli, diff, rebase
        articleSection: Git
        about:
          - "@type": SoftwareApplication
            name: Git
        abstract: "Six git config one-liners worth setting: branch.sort=-committerdate, column.ui=auto, rebase.autosquash, push.autoSetupRemote, diff.algorithm=histogram and help.autocorrect. They fix defaults git keeps only for backward compatibility."
        speakable:
          "@type": SpeakableSpecification
          cssSelector:
            - .post-tldr
            - h1
        image: https://lukeocodes.dev/og.png?h=The+git+config+Defaults+Worth+Overriding&d=A+few+git+config+defaults+are+just+wrong+for+modern+work.+These+one-liners+fix+branch+sorting%2C+new-branch+pushes%2C+diffs+and+command+typos.&e=Writing
        wordCount: 573
        timeRequired: PT3M
        publisher:
          "@id": https://lukeocodes.dev/authors/luke#person
      - "@type": BreadcrumbList
        itemListElement:
          - "@type": ListItem
            position: 1
            name: Home
            item: https://lukeocodes.dev
          - "@type": ListItem
            position: 2
            name: Writing
            item: https://lukeocodes.dev/blog
          - "@type": ListItem
            position: 3
            name: The git config Defaults Worth Overriding
            item: https://lukeocodes.dev/git-config-defaults
      - "@type": FAQPage
        "@id": https://lukeocodes.dev/git-config-defaults#faq
        mainEntity:
          - "@type": Question
            name: Why doesn't git ship these defaults itself?
            acceptedAnswer:
              "@type": Answer
              text: Backward compatibility. Changing a default can break scripts and muscle memory across millions of repos, so git keeps old behaviour and lets you opt in. Some of these settings date from before the workflows most people use now existed.
          - "@type": Question
            name: Do these git config settings apply globally?
            acceptedAnswer:
              "@type": Answer
              text: Add --global and they go in ~/.gitconfig and apply to every repo you own. Leave it off and they write to the current repo's .git/config only. Most of these you want globally, set once per machine.
          - "@type": Question
            name: What does push.autoSetupRemote actually save me?
            acceptedAnswer:
              "@type": Answer
              text: The git push fatal error on a brand-new branch that has no upstream. With push.autoSetupRemote=true, the first push creates the matching remote branch automatically instead of making you type git push -u origin branchname.
          - "@type": Question
            name: Is diff.algorithm=histogram safe to switch to?
            acceptedAnswer:
              "@type": Answer
              text: Yes. It only changes how git chooses which lines count as changed, producing cleaner diffs especially in reordered code. It never changes your files or history, just the diff output, so there's no downside to enabling it.
---

[Luke Oliff.](/)

- [Blog](/blog)
- [CV](/cv)
- [Uses](/uses)
- [User manual](/user-manual)
- [Living with ADHD](/living-and-working-with-adhd)
- [RSS](/rss.xml)

[Luke Oliff · Writing](/blog)

# The git config Defaults Worth Overriding

Sep 2026 · [Git](/blog/category/git) · 3 min read · [Luke Oliff](/authors/luke)

**TL;DR:** Six git config one-liners worth setting: branch.sort=-committerdate, column.ui=auto, rebase.autosquash, push.autoSetupRemote, diff.algorithm=histogram and help.autocorrect. They fix defaults git keeps only for backward compatibility.

Some git config defaults are wrong for how anyone works in 2026, and git keeps them only so it doesn't break twenty years of scripts. A handful of one-liners fix the worst of them: branches sorted by date instead of alphabet, pushes that set up their own remote, diffs from a smarter algorithm, and a typo-correcting `git`. Set them once with `--global` and forget about it.

The `branch.sort` tip in particular [made the Hacker News front page](https://news.ycombinator.com/item?id=49435285), which is how a lot of people found out git could do it at all. The rest are from the [GitButler write-up on how core git devs configure git](https://blog.gitbutler.com/how-git-core-devs-configure-git), and I've verified each flag against `git help config`.

## Sort branches by date, not the alphabet

`git branch` lists alphabetically by default, which tells you nothing about what you were doing yesterday.

```bash
git config --global branch.sort -committerdate
```

Now the branch you touched most recently is at the top. The one you branched off in March and abandoned sinks to the bottom where it belongs. This is the change I miss most on a machine that doesn't have it.

## Put lists in columns

```bash
git config --global column.ui auto
```

`git branch`, `git status` and `git tag` will lay long lists out in columns when the terminal is wide enough, instead of one item per line burning half your scrollback. Small, but it's on every time you list anything.

## Stop fighting git push on new branches

Push a brand-new branch with the defaults and git refuses, demanding `git push -u origin branchname`. Every time.

```bash
git config --global push.autoSetupRemote true
```

Now the first `git push` creates the matching upstream branch itself. One less rote command in the loop you run twenty times a day.

## Make rebase autosquash work for you

If you write fixup commits with `git commit --fixup=<hash>`, an interactive rebase can reorder and squash them automatically, but only if you ask for `--autosquash` every time. Make it the default:

```bash
git config --global rebase.autosquash true
```

Then `git rebase -i` slots your `fixup!` commits next to their targets and marks them to squash, no manual reordering. It's the other half of the small-commits workflow.

## Get better diffs

Git's default diff still uses the Myers algorithm from 1986. The histogram algorithm is smarter about moved and reordered code, and it costs you nothing:

```bash
git config --global diff.algorithm histogram
```

Diffs where a function moved read as a move, not as one giant deletion next to one giant addition. It changes the output only, never your files.

## Let git fix your typos

```bash
git config --global help.autocorrect prompt
```

Type `git stauts` and git offers `status` and asks before running it. You can also set a number, where `help.autocorrect 10` runs the guessed command after a one-second pause (the value is in tenths of a second). `prompt` is the polite version. Either beats the default, which just tells you `git: 'stauts' is not a git command` and gives up.

None of these change history or touch a file. They change how git talks to you, and the defaults it ships are the cautious, compatible ones, not the good ones. Copy the six lines into your global config and the tool stops getting in the way. That's the whole pitch for auditing your git config defaults: five minutes now against a hundred tiny frictions a week you've stopped noticing.

[← Newer: Everyone Should Slow Down AI. Except Them.](/slowing-down-ai)

[All posts](/blog) →

## Search this site

`GET https://lukeocodes.dev/search.json?q=<words>` returns matching posts as JSON, each with its page URL and its markdown URL. Add `&limit=<1-50>` for more than 10. How it works: [/blog/search](https://lukeocodes.dev/blog/search.md).

```sh
curl "https://lukeocodes.dev/search.json?q=developer+relations"
```

---

© 2026 Luke Oliff. Posts live at the root of this site.

- [GitHub](https://github.com/lukeocodes)
- [LinkedIn](https://www.linkedin.com/in/lukeocodes)
- [X](https://x.com/lukeocodes)
- [Bluesky](https://bsky.app/profile/lukeocodes.dev)
- [Email](mailto:luke@lukeoliff.com)
- [RSS](/rss.xml)

## Cookies

This site sets one analytics cookie, from Google Analytics, and only in a browser that accepts the cookie banner. A client that does not run scripts sets no cookies, so there is nothing to accept or decline here.

[Cookie policy](/cookies)
