Reputation: 6651
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
This is some of the output when running git status
.
I don't mind the "Changes not staged for commit:" message, but I don't want to see "help" commands about how to "update what will be committed" etc, as they just add a lot of noise.
I know about git status -s
, but that's not what I really want.
Is there any way of getting rid of the help messages?
Upvotes: 11
Views: 805
Reputation: 1323773
Those help messages were added in Git 1.5 (Q1 2007)
(Merged by Junio C Hamano -- gitster
-- in commit 4d22965, 11 Jan 2007)
git-status
: wording update to deal with deleted files.
If you do:
$ /bin/rm foo $ git status
we used to say "
git add ...
"(man)
to add content to commit".
But suggesting "git add
" to record the deletion of a file is simply insane.So this rewords various things:
- The section header is the old "
Changed but not updated
", instead of "Changed but not added
";- Suggestion is
"git add ..." to update what will be committed"
, instead of "... to add content to commit
";- If there are removed paths, the above suggestion becomes
git add/rm ... to update what will be committed
";- For untracked files, the suggestion is
"git add ..." to include in what will be committed"
.
Then with Git 1.6 (Q4 2008), the header generation evolves:
See commit 4d6e4c4, commit bb914b1 (08 Sep 2008) by Anders Melchiorsen (amelchio
).
(Merged by Shawn O. Pearce -- spearce
-- in commit 6ef1daf, 25 Sep 2008)
wt-status
: Split header generation into three functions
Reorganize header generation so that all header text related to each block is in one place.
This adds a function, but makes it easier to see what is generated in each case.
It also allows for easy tweaking of individual headers.
It now calls wt_status_print_dirty_header
... until Git 2.11 (Q4 2016), which enhances "git status --porcelain
"(man) output by collecting more data on the state of the index and the working tree files, which may further be used to teach git-prompt
(in contrib/
) to make fewer calls to git.
See commit 888525d (12 Aug 2016), commit b249e39, commit 1cd828d, commit d9fc746, commit 24959ba, commit 1ecdecc (11 Aug 2016), and commit c4f596b, commit be7e795, commit 957a0fe (05 Aug 2016) by Jeff Hostetler (Jeff-Hostetler
).
(Merged by Junio C Hamano -- gitster
-- in commit 00d2793, 08 Sep 2016)
status
: rename long-format print routinesSigned-off-by: Jeff Hostetler
Rename the various
wt_status_print*()
routines to bewt_longstatus_print*()
to make it clear that these routines are only concerned with the normal/long status output and reduce developer confusion as other status formats are added in the future.
The current (Aug. 2021) code of wt_longstatus_print_dirty_header
show
static void wt_longstatus_print_dirty_header(struct wt_status *s,
int has_deleted,
int has_dirty_submodules)
{
const char *c = color(WT_STATUS_HEADER, s);
status_printf_ln(s, c, _("Changes not staged for commit:"));
if (!s->hints)
return;
The if (!s->hints)
part comes from Git 1.8.5 (Q4 2013), from the commit log template, which removes irrelevant "advice" messages that are shared with "git status
"(man) output.
See commit ea9882b, commit 6a964f5, commit 5c25dfa (12 Sep 2013) by Matthieu Moy (moy
).
(Merged by Junio C Hamano -- gitster
-- in commit b4980c6, 20 Sep 2013)
wt-status
: turnadvice_status_hints
into a field ofwt_status
Signed-off-by: Matthieu Moy
No behavior change in this patch, but this makes the display of status hints more flexible as they can be enabled or disabled for individual calls to
commit.c
:run_status().
That does use the option advice.statusHints
introduced with Git 1.6.5 (Q4 2009)
See commit edf563f, commit 7519443 (09 Sep 2009) by Jeff King (peff
).
(Merged by Junio C Hamano -- gitster
-- in commit dc1b0c0, 13 Sep 2009)
status
: make "how to stage" messages optionalSigned-off-by: Jeff King
These messages are nice for new users, but experienced git users know how to manipulate the index, and these messages waste a lot of screen real estate.
config
now includes in its man page:
statusHints
Directions on how to stage/unstage/add shown in the output of
git status
and the template shown when writing commit messages. Default: true.
If confirm that with the latest Git 2.33 (in my case git version 2.33.0.windows.2), this option works:
C:\Users\vonc\git\git>git -c "advice.statusHints=off" st
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
aFile
As opposed to:
Untracked files:
(use "git add <file>..." to include in what will be committed)
a
Upvotes: 3
Reputation: 2726
In the git-config
documentation you can find the variable statusHints
of the subsection advice.*
which is explained like this:
statusHints
Show directions on how to proceed from the current state in the output of git-status(1), in the template shown when writing commit messages in git-commit(1), and in the help message shown by git-checkout(1) when switching branch.
So I would assume setting
$ git config advice.statusHints off
should get rid of these messages (for the local repository, use --global
for all repositories of the current user on this machine)
Upvotes: 9