git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git log of all (modifying) commands run on a repo?

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 7, 2007, 22:59 UTC
Message-ID
<200702072359.08043.jnareb@gmail.com>
In-Reply-To
<17866.21770.762672.84327@lisa.zopyra.com>
Bill Lear wrote:
Show 13 quoted lines
> On Wednesday, February 7, 2007 at 23:29:56 (+0100) Jakub Narebski writes:
>>...
>> 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 <jnareb@gmail.com> 1170836783 +0100 \
    pull origin git://git.kernel.org/pub/scm/git/git.git: fast-forward
 e68989... 6506e1... Jakub Narebski <jnareb@gmail.com> 1170873620 +0100 \
   fetch origin git://git.kernel.org/pub/scm/git/git.git: fast-forward
 * git/logs/refs/heads/master
 93342d... 39daf6... Jakub Narebski <jnareb@gmail.com> 1169555797 +0100 \
   commit: t/t1300-repo-config.sh: value continued on next line
 39daf6... b62502... Jakub Narebski <jnareb@gmail.com> 1169809125 +0100 \
   commit (merge): Merge branch 'master' of git://git.kernel.org/pub/scm/git/git
 b62502... 7ab704... Jakub Narebski <jnareb@gmail.com> 1170150241 +0100 \
   pull origin: Merge made by recursive.
 7ab704... bb77c5... Jakub Narebski <jnareb@gmail.com> 1170238531 +0100 \
   pull origin: In-index merge
 * git/logs/refs/heads/gitweb/web
 ceae8a... a29878... Jakub Narebski <jnareb@gmail.com> 1169973601 +0100 \
   commit: Git config file reader in Perl (WIP 5)
 a29878... 1b600e... Jakub Narebski <jnareb@gmail.com> 1170034498 +0100 \
   reset --hard 1b600e659abc7e409c9d830e332d3cef010
 62c1c1... 05b936... Jakub Narebski <jnareb@gmail.com> 1170034499 +0100 \
   rebase: Git config file reader in Perl (WIP 1)
-- 
Jakub Narebski
Poland
Previous: Bill LearNext: Linus Torvalds
Message 4 of 25 in “Git log of all (modifying) commands run on a repo?”
  1. Bill LearFeb 7, 2007
  2. Jakub NarebskiFeb 7, 2007
  3. Bill LearFeb 7, 2007
  4. Jakub NarebskiFeb 7, 2007
  5. Linus TorvaldsFeb 7, 2007
  6. Junio C HamanoFeb 7, 2007
  7. Shawn O. PearceFeb 7, 2007
  8. Linus TorvaldsFeb 7, 2007
  9. Junio C HamanoFeb 7, 2007
  10. Linus TorvaldsFeb 7, 2007
  11. Jakub NarebskiFeb 7, 2007
  12. Johannes SchindelinFeb 7, 2007
  13. Shawn O. PearceFeb 8, 2007
  14. Junio C HamanoFeb 8, 2007
  15. Johannes SchindelinFeb 8, 2007
  16. Junio C HamanoFeb 8, 2007
  17. Johannes SchindelinFeb 8, 2007
  18. Linus TorvaldsFeb 8, 2007
  19. Johannes SchindelinFeb 8, 2007
  20. Shawn O. PearceFeb 7, 2007
  21. Bill LearFeb 7, 2007
  22. Linus TorvaldsFeb 7, 2007
  23. Bill LearFeb 7, 2007
  24. Linus TorvaldsFeb 7, 2007
  25. Johannes SixtFeb 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.