Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why git push --quiet produce output?

Tags:

git

I'm doing git push with a quiet flag and expect that git will not produce any messages. The documentation says

--quiet Suppress all output, including the listing of updated refs, unless an error occurs. Progress is not reported to the standard error stream.

but I still receive "Branch develop....". Why is that?

> $ git status 
> On branch develop
> Your branch is up-to-date with 'origin/develop'.
> nothing to commit, working directory clean
> 
> $ git push --set-upstream origin develop --quiet
> Branch develop set up to track remote branch develop from origin.
like image 440
Mikhail Chibel Avatar asked Jul 01 '16 01:07

Mikhail Chibel


People also ask

Why does git push so long?

If you are starting a new project from a clone, (from the CLI without a fork) when you push to a blank remote you are pushing the entire history of the project you just cloned. This is going to take some time. If you just need the clone as it stands and you don't want the history, delete the .

What does git push actually do?

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.

Can git fetch but not push?

Some common reasons include: - You are not logged in to your account: see File > Options. - You may need to log out and log back in to refresh your token. - You do not have permission to access this repository. - The repository is archived on GitHub.

What is git push origin Branch_name?

To push the branch or you can say to push the changes in the branch to the Github repo you have to run this command “git push origin <the branch name>” in our case the branch name is “main”. After pushing the changes the repo will look like and this is how you can push a branch to a remotely hosted GitHub repository.


2 Answers

It's the --set-upstream that is producing that message. The push is totally quiet. --set-upstream is effectively a call-out to git branch -u upstream/foo. If you want git branch to be silent, you will need to call it yourself, with its own --quiet option.

like image 177
Paul Hicks Avatar answered Sep 20 '22 02:09

Paul Hicks


"git push --quiet --set-upstream``"(man) was not, indeed, quiet when setting the upstream branch configuration.

That has been corrected with Git 2.32 (Q2 2021).

See commit f3cce89 (15 Apr 2021) by Øystein Walle (Osse).
(Merged by Junio C Hamano -- gitster -- in commit a819e2b, 30 Apr 2021)

transport: respect verbosity when setting upstream

Signed-off-by: Øystein Walle

A command such as git push(man) -qu origin feature will print "Branch 'feature' set up to track remote branch 'feature' from 'origin'." even when --quiet is passed.
In this case it's because install_branch_config() is always called with BRANCH_CONFIG_VERBOSE.

struct transport keeps track of the desired verbosity.
Fix the above issue by passing BRANCH_CONFIG_VERBOSE conditionally based on that.

This should now be actually quiet:

git push --quiet -u --no-progress upstream main
like image 27
VonC Avatar answered Sep 19 '22 02:09

VonC