DenCowboy DenCowboy - 3 years ago 208
Git Question

How to reduce the git output when checking out a tag

When I checkout a tag I get this output:

λ git checkout REL-6.2.0
Note: checking out 'REL-6.2.0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b <new-branch-name>

HEAD is now at c154795... Set REL-6.2.0 in pom.xml on release/6.2.0 branch.

Is there a way to make the output a bit less or without the
git checkout
-b proposal? I know I can use something like
> /dev/null
but I would like some output but just less

Answer Source

From the documentation for git checkout, you can use the --quiet flag to suppress certain types of output:

git checkout --quiet    # or just -q

I just checked out a prior commit on a local branch in the detached head state using the --quiet flag and there was no output in the console from Git. Instead, I just saw the new prompt:

/c/users/timbiegeleisen/documents/project ((9e51b34...))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download