Ciasto piekarz
Ciasto piekarz

Reputation: 8277

Are git messages we see in shell logged?

This thing came out of curiosity, do git messages that we see in shell every time we run any git command do they get logged or just stdout to shell ?

Upvotes: 2

Views: 49

Answers (2)

VonC
VonC

Reputation: 1328182

server-side Git logs

On the server side, it depends on the Git repo hosting service.
If you have control of the server you are pushing to, an intermediate authorization layer like gitolite can register any Git event (push/pull/clone, ...)

client-side Git logs

so if I get message like fatal error rejected due to non-fast-forward, and user closes its terminal and next day he doesn't remember where he was will he be able to find out what happened yesterday that he stopped working on ?

Git itself doesn't provide any logs, and only a Git wrapper of some kind could add that feature.
For instance hub or gitflow could be adapter to add logs.

In these day and age, one good wrapper coud be a docker container for executing Git command (meaning any container with Git installed, and mounting your repo as a volume)

Then, as mentioned in issue 7440 ,the command docker logs could keep track of any output or error message. But you would have to filter through said logs in order to make sense of them.

docker run -d --name gitcontainer gitimage
docker logs gitcontainer > stdout.log 2>stderr.log
cat stdout.log
cat stderr.log

A docker container can run on Linux, or other platforms (Windows, Mac) through a virtual machine.

Upvotes: 0

Matthieu Moy
Matthieu Moy

Reputation: 16587

Messages you see on the command-line are not logged by default (i.e. Git is talking to you normally through printf). Actions you do on the Git repository are logged (either recorded in history or in the reflog).

Upvotes: 1

Related Questions