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.
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 .
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.
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.
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.
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.
"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 upstreamSigned-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 becauseinstall_branch_config()
is always called withBRANCH_CONFIG_VERBOSE
.
struct transport
keeps track of the desired verbosity.
Fix the above issue by passingBRANCH_CONFIG_VERBOSE
conditionally based on that.
This should now be actually quiet:
git push --quiet -u --no-progress upstream main
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With