Git: How to disable status advice

Unwanted advice is annoying, no matter how it’s dressed up (generated by Stable Diffusion)

Many Git commands output “advice”, with hints about which commands you could run next. Most notably, git status gives you advice for what to do about files in each state:

$ git status
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
  new file:   cocobolo.txt

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
  deleted:    oak.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)
  pine.txt

If you’re comfortable with Git, you might start to find these hints to be unnecessary “visual noise”. Thankfully, if you’d like the screen space back, you can disable the messages with the advice.statusHints option:

$ git config --global advice.statusHints false

…which will add to your ~/.gitconfig:

[advice]
    statusHints = false

From then on, running git status will show only information:

$ git status
On branch main
Changes to be committed:
  new file:   cocobolo.txt

Changes not staged for commit:
  deleted:    oak.txt

Untracked files:
  pine.txt

Brilliant.

Short mode

If you want even less output, you can use the -s option for git status:

$ git status -s
A  cocobolo.txt
 D oak.txt
?? pine.txt

The preceeding letters indicate the file’s state. It’s a bit harder to read, though it looks better with colourization.

(This is actually the form of git status I use the most.)

Other advice

At time of writing, Git has 33 different advice.* options. That’s a lot of potential advice you could disable! However, most of the options are fairly niche. I wouldn’t worry about reading up on them, but keep the idea in mind if a particular message begins to bother you.

Fin

May you only be advised as much as you wish,

—Adam


If your Django project’s long test runs bore you, I wrote a book that can help.


Subscribe via RSS, Twitter, Mastodon, or email:

One summary email a week, no spam, I pinky promise.

Related posts:

Tags: