0

I consider the output of git-push to be quite verbose:

$ git push 
Enumerating objects: 36, done.
Counting objects: 100% (36/36), done.
Delta compression using up to 8 threads
Compressing objects: 100% (23/23), done.
Writing objects: 100% (26/26), 2.45 KiB | 1.23 MiB/s, done.
Total 26 (delta 19), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (19/19), completed with 8 local objects.
To github.com:DataBiosphere/azul.git
 + 541326b5...69385318 issues/noah-aviel-dove/3372-implicit-source-filter-circumvented -> issues/noah-aviel-dove/3372-implicit-source-filter-circumvented

The only parts of this output I find interesting or useful are:

  • The name of the remote repository to which I'm pushing
  • The name of the remote branch
  • The name of the local branch
  • (Not included in the example above) any error messages or warnings

According to this answer, the rest of the output comes from git-count-objects.

I consider this extra output to be a distracting and obstructive waste of screen space. I am looking for a way to change the behavior of git-push that accomplishes two things:

  1. Suppress or reduce the output from git-count-objects
  2. Do not supress the elements of the output that I do find useful (all of the bullet points listed above).

The --quiet flag fails my second criterion. Is there another way to exert finer control over the output of git-push?

ApproachingDarknessFish
  • 14,133
  • 7
  • 40
  • 79

1 Answers1

0

My working solution to is alias git-push to a bash script that runs:

git push --dry-run $@ && git push --quiet $@;

Since the statistics on the sent objects are not printed when the objects are not actually sent. This produces the output:

$ git push
To github.com:DataBiosphere/azul.git
   e324c486..9990e272  issues/noah-aviel-dove/3372-implicit-source-filter-circumvented -> issues/noah-aviel-dove/3372-implicit-source-filter-circumvented

Which is ideal. However, the double invocation of git-push introduces a small but noticeable amount of latency. There may exist a superior solution that avoids this.

ApproachingDarknessFish
  • 14,133
  • 7
  • 40
  • 79
  • Did you experiment with `|` or `while read` to clear the default `git push` output? – terrorrussia-keeps-killing Oct 07 '21 at 05:24
  • @fluffy I considered that approach but considered it to be fragile since I wasn't confident that there might be other output formats I hasn't yet observed. I'm generally very cautious when it comes to piping from programs whose output isn't intended to be parsed programmatically. Although if you have a working example of this approach, I'd be curious to see it. – ApproachingDarknessFish Oct 07 '21 at 06:19
  • Nope, unfortunately no. I don't see anything really annoying in the `git push` output -- at least it clearly indicates that something is going. However, I haven't check your double-command approach, but doesn't it suppress from-remote messages too? – terrorrussia-keeps-killing Oct 07 '21 at 06:28