Re: Git log of all (modifying) commands run on a repo?
From: Jakub Narebski <hidden>
Date: 2016-06-15 22:42:53
Bill Lear wrote:
On Wednesday, February 7, 2007 at 23:29:56 (+0100) Jakub Narebski writes:quoted
... Is history of shell commands too short? Reflogs doesn't help (concatenate all reflogs, perhaps preceding them with file name, and sort by date) either?Well, I thought of shell history also, but the problem is, that we often have multiple repos on a machine (we may be executing a long-running experiment in one, for example, and not want to disturb it). Shell history in that case doesn't help. Also, not having the branch information is a minus (each of us puts the current git branch in our prompt).
Fact. Although in worst case, if shell history is deep enough, you could do forensic on it... unless you use multiple shells, freely interspersing commands in them...
I didn't know about reflogs. What did you have in mind? Could you show an example, please?
Unfortunately till some time ago reflogs were not enabled by default.
If they are enabled, for each branch you should have
$GIT_DIR/logs/refs/heads/<branch> file, which contains information about
operations on given branch. It has pre- and post-operation commit ids,
and timestamp of a change, together with short description. You could
concatenate reflogs, and sort them by timestamp.
Reflogs are purely local matter, they represent local view of history.
See git-update-ref(1), "Logging Updates" section, git-repo-config(1)
(or git-config(1)), description of core.logAllRefUpdates variable,
and Git User's Manual.
Examples (sha1 are shortened, and lines are broken for easier reading):
* .git/logs/refs/heads/origin
798123... e68989... Jakub Narebski [off-list ref] 1170836783 +0100 \
pull origin git://git.kernel.org/pub/scm/git/git.git: fast-forward
e68989... 6506e1... Jakub Narebski [off-list ref] 1170873620 +0100 \
fetch origin git://git.kernel.org/pub/scm/git/git.git: fast-forward
* git/logs/refs/heads/master
93342d... 39daf6... Jakub Narebski [off-list ref] 1169555797 +0100 \
commit: t/t1300-repo-config.sh: value continued on next line
39daf6... b62502... Jakub Narebski [off-list ref] 1169809125 +0100 \
commit (merge): Merge branch 'master' of git://git.kernel.org/pub/scm/git/git
b62502... 7ab704... Jakub Narebski [off-list ref] 1170150241 +0100 \
pull origin: Merge made by recursive.
7ab704... bb77c5... Jakub Narebski [off-list ref] 1170238531 +0100 \
pull origin: In-index merge
* git/logs/refs/heads/gitweb/web
ceae8a... a29878... Jakub Narebski [off-list ref] 1169973601 +0100 \
commit: Git config file reader in Perl (WIP 5)
a29878... 1b600e... Jakub Narebski [off-list ref] 1170034498 +0100 \
reset --hard 1b600e659abc7e409c9d830e332d3cef010
62c1c1... 05b936... Jakub Narebski [off-list ref] 1170034499 +0100 \
rebase: Git config file reader in Perl (WIP 1)
--
Jakub Narebski
Poland