{"thread":{"id":"6729","subject":"Git log of all (modifying) commands run on a repo?","startedAt":"2007-02-07T22:15:31Z","lastAt":"2007-02-08T18:36:58Z","messageCount":25,"participants":["Bill Lear","Jakub Narebski","Linus Torvalds","Junio C Hamano","Shawn O. Pearce","Johannes Schindelin","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"33861","messageId":"17866.20355.744025.133326@lisa.zopyra.com","threadId":"6729","inReplyTo":null,"subject":"Git log of all (modifying) commands run on a repo?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-07T22:15:31Z","receivedAt":"2007-02-07T22:15:31Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"Our company recently switched to git.  Our enthusiasm for git outweighs\nthe problems we have encountered so far, universally those of user\nbefuddlement, not git problems per se.\n\nI have destroyed several repos by accidentally pulling from or pushing\nto the wrong branch, not realizing this until later, and, trying what\nI thought the proper way to undo it, failed that miserably.  I have\ndestroyed a few other repos by pulling from a \"polluted\" repo of a\nco-worker that had mistakenly merged things in, and have had to resort\neach time to full-scale reconstructions (again, almost trivially\naccomplished thanks to git).  Thankfully, our company repo is so far\npristine, and I have been able to quickly reconstruct things and\ncontinue working.\n\nA co-worker just called to say he apparently had done something\nsimilar, as he tried to pull from our company repo, got a conflict,\nand then discovered files and changes to files that should not have\nbeen on the master branch.  These files and changes do not exist in\nour company repo, of that we are certain.\n\nI'm not certain how I managed to screw up my repo, and he is equally\nunsure of how he managed to screw up his.\n\nI thought that it would be very useful to have a history of git\ncommands that have been run against a repo, in order to hopefully\ndebug this sort of thing --- perhaps only those that modify the repo.\n\nI suppose this would need to include information about which branches\nwere affected as well.\n\n% cat .git/repo.log\n[....]\n2007-02-07 10:05:44 git pull . .....\n** Pull from master branch onto project branch\n** Pull from foobar branch onto boobar branch\n** ...\n2007-02-07 10:05:44 git pull git://source/project master:project\n** Your explanation here...\n\nWould this sort of thing be easy to do?  I presume git does not\ncurrently have support for this, but thought I would ask.\n\n\nBill\n"},{"id":"33863","messageId":"eqdjt3$jo5$1@sea.gmane.org","threadId":"6729","inReplyTo":"17866.20355.744025.133326@lisa.zopyra.com","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-07T22:29:56Z","receivedAt":"2007-02-07T22:29:56Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: git@vger.kernel.org]\n\nBill Lear wrote:\n\n> I thought that it would be very useful to have a history of git\n> commands that have been run against a repo, in order to hopefully\n> debug this sort of thing --- perhaps only those that modify the repo.\n> \n[...]\n> Would this sort of thing be easy to do?  I presume git does not\n> currently have support for this, but thought I would ask.\n\nIf all commands were run via git wrapper (and all scripts would\nuse git-command version, perhaps with exception of gitweb), it\nwould be fairly easy to do (although this should probably be\nrepository config variable).\n\nIs history of shell commands too short? Reflogs doesn't help\n(concatenate all reflogs, perhaps preceding them with file name,\nand sort by date) either?\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"33865","messageId":"17866.21770.762672.84327@lisa.zopyra.com","threadId":"6729","inReplyTo":"eqdjt3$jo5$1@sea.gmane.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-07T22:39:06Z","receivedAt":"2007-02-07T22:39:06Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 7, 2007 at 23:29:56 (+0100) Jakub Narebski writes:\n>...\n>Is history of shell commands too short? Reflogs doesn't help\n>(concatenate all reflogs, perhaps preceding them with file name,\n>and sort by date) either?\n\nWell, I thought of shell history also, but the problem is, that we often\nhave multiple repos on a machine (we may be executing a long-running\nexperiment in one, for example, and not want to disturb it).\n\nShell history in that case doesn't help.  Also, not having the branch\ninformation is a minus (each of us puts the current git branch in our\nprompt).\n\nI didn't know about reflogs.  What did you have in mind?  Could you\nshow an example, please?\n\n\nBill\n"},{"id":"33867","messageId":"Pine.LNX.4.64.0702071441160.8424@woody.linux-foundation.org","threadId":"6729","inReplyTo":"17866.20355.744025.133326@lisa.zopyra.com","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-07T22:49:50Z","receivedAt":"2007-02-07T22:49:50Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 7 Feb 2007, Bill Lear wrote:\n> \n> I thought that it would be very useful to have a history of git\n> commands that have been run against a repo, in order to hopefully\n> debug this sort of thing --- perhaps only those that modify the repo.\n\nThe \"reflog\" is kind of that, and you can literally do\n\n\tless .git/logs/refs/heads/master\n\nto get some kind of idea what's up.\n\nNewer gits enable reflogs by default, older gits don't (and *really* old \ngit versions don't support it at all).\n\nOf course, we should probably just have a\n\n\tgit reflog show\n\ncommand for this to make it prettier.\n\nNOTE! It's very much per-repository. When you push out your changes, your \nreflog stays private.\n\n\t\t\tLinus\n"},{"id":"33870","messageId":"7vd54l60gg.fsf@assigned-by-dhcp.cox.net","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071441160.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-07T22:56:47Z","receivedAt":"2007-02-07T22:56:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Wed, 7 Feb 2007, Bill Lear wrote:\n>> \n>> I thought that it would be very useful to have a history of git\n>> commands that have been run against a repo, in order to hopefully\n>> debug this sort of thing --- perhaps only those that modify the repo.\n>\n> The \"reflog\" is kind of that, and you can literally do\n>\n> \tless .git/logs/refs/heads/master\n>\n> to get some kind of idea what's up.\n>\n> Newer gits enable reflogs by default, older gits don't (and *really* old \n> git versions don't support it at all).\n>\n> Of course, we should probably just have a\n>\n> \tgit reflog show\n>\n> command for this to make it prettier.\n\n\t$ git log -g?\n"},{"id":"33871","messageId":"20070207225723.GB1970@spearce.org","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071441160.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-07T22:57:23Z","receivedAt":"2007-02-07T22:57:23Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> wrote:\n> Of course, we should probably just have a\n> \n> \tgit reflog show\n> \n> command for this to make it prettier.\n\nI tried that (I submitted patches to create `git reflog show`).\nDscho's `git log -g` was the better candidate, and won.\nIts already in git.git's master branch.\n\n-- \nShawn.\n"},{"id":"33873","messageId":"200702072359.08043.jnareb@gmail.com","threadId":"6729","inReplyTo":"17866.21770.762672.84327@lisa.zopyra.com","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-07T22:59:07Z","receivedAt":"2007-02-07T22:59:07Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Bill Lear wrote:\n> On Wednesday, February 7, 2007 at 23:29:56 (+0100) Jakub Narebski writes:\n>>...\n>> Is history of shell commands too short? Reflogs doesn't help\n>> (concatenate all reflogs, perhaps preceding them with file name,\n>> and sort by date) either?\n> \n> Well, I thought of shell history also, but the problem is, that we often\n> have multiple repos on a machine (we may be executing a long-running\n> experiment in one, for example, and not want to disturb it).\n> \n> Shell history in that case doesn't help.  Also, not having the branch\n> information is a minus (each of us puts the current git branch in our\n> prompt).\n\nFact. Although in worst case, if shell history is deep enough, you could\ndo forensic on it... unless you use multiple shells, freely interspersing\ncommands in them...\n \n> I didn't know about reflogs.  What did you have in mind?  Could you\n> show an example, please?\n\nUnfortunately till some time ago reflogs were not enabled by default.\nIf they are enabled, for each branch you should have \n$GIT_DIR/logs/refs/heads/<branch> file, which contains information about\noperations on given branch. It has pre- and post-operation commit ids,\nand timestamp of a change, together with short description. You could\nconcatenate reflogs, and sort them by timestamp.\n\nReflogs are purely local matter, they represent local view of history.\n\nSee git-update-ref(1), \"Logging Updates\" section, git-repo-config(1)\n(or git-config(1)), description of core.logAllRefUpdates variable,\nand Git User's Manual.\n\n\nExamples (sha1 are shortened, and lines are broken for easier reading):\n\n * .git/logs/refs/heads/origin\n 798123... e68989... Jakub Narebski <jnareb@gmail.com> 1170836783 +0100 \\\n    pull origin git://git.kernel.org/pub/scm/git/git.git: fast-forward\n e68989... 6506e1... Jakub Narebski <jnareb@gmail.com> 1170873620 +0100 \\\n   fetch origin git://git.kernel.org/pub/scm/git/git.git: fast-forward\n\n * git/logs/refs/heads/master\n 93342d... 39daf6... Jakub Narebski <jnareb@gmail.com> 1169555797 +0100 \\\n   commit: t/t1300-repo-config.sh: value continued on next line\n 39daf6... b62502... Jakub Narebski <jnareb@gmail.com> 1169809125 +0100 \\\n   commit (merge): Merge branch 'master' of git://git.kernel.org/pub/scm/git/git\n b62502... 7ab704... Jakub Narebski <jnareb@gmail.com> 1170150241 +0100 \\\n   pull origin: Merge made by recursive.\n 7ab704... bb77c5... Jakub Narebski <jnareb@gmail.com> 1170238531 +0100 \\\n   pull origin: In-index merge\n\n * git/logs/refs/heads/gitweb/web\n ceae8a... a29878... Jakub Narebski <jnareb@gmail.com> 1169973601 +0100 \\\n   commit: Git config file reader in Perl (WIP 5)\n a29878... 1b600e... Jakub Narebski <jnareb@gmail.com> 1170034498 +0100 \\\n   reset --hard 1b600e659abc7e409c9d830e332d3cef010\n 62c1c1... 05b936... Jakub Narebski <jnareb@gmail.com> 1170034499 +0100 \\\n   rebase: Git config file reader in Perl (WIP 1)\n-- \nJakub Narebski\nPoland\n"},{"id":"33874","messageId":"17866.23050.937572.192253@lisa.zopyra.com","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071441160.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-07T23:00:26Z","receivedAt":"2007-02-07T23:00:26Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 7, 2007 at 14:49:50 (-0800) Linus Torvalds writes:\n>...\n>The \"reflog\" is kind of that, and you can literally do\n>\n>\tless .git/logs/refs/heads/master\n>\n>to get some kind of idea what's up.\n>\n>Newer gits enable reflogs by default, older gits don't (and *really* old \n>git versions don't support it at all).\n\nAh, I don't seem to have .git/logs at all.\n\nWe plan to upgrade to 1.5 when it's out, so I guess we'll just\nhave to wait.\n\n\nBill\n"},{"id":"33875","messageId":"Pine.LNX.4.64.0702071451030.8424@woody.linux-foundation.org","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071441160.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-07T23:02:53Z","receivedAt":"2007-02-07T23:02:53Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 7 Feb 2007, Linus Torvalds wrote:\n> \n> Newer gits enable reflogs by default [...]\n\nThis, btw, is only true for non-bare ones. \n\nIn particular, if you only _push_ to a repository, it won't have reflogs \nenabled by default, because pushing is a \"bare git\" action even if it \nactually has a working tree (because the push will ignore the working tree \nand enter the \".git\" directory itself).\n\nSo even with new git, if you want to have reflogs enabled for shared \nrepositories that people push to (as opposed to the individual *developer* \nrepositories), you need to enable reflogs by hand (either in the git \nconfig file, or by just creating the empty log file).\n\n\t\tLinus\n"},{"id":"33876","messageId":"20070207230317.GC1970@spearce.org","threadId":"6729","inReplyTo":"7vd54l60gg.fsf@assigned-by-dhcp.cox.net","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-07T23:03:17Z","receivedAt":"2007-02-07T23:03:17Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> \t$ git log -g?\n\n\t[git (build)]$ git log -g?\n\tfatal: unrecognized argument: -g?\n\nI think its:\n\n\t[git (build)]$ git log -g ?\n\tcommit 6506e156d99bd406661cd5d2e502db7c0960d716\n\tReflog: HEAD@{0} (Shawn O. Pearce <spearce@spearce.org>)\n\tReflog message: merge origin/master: Fast forward\n\tAuthor: Junio C Hamano <junkio@cox.net>\n\t...\n\nat least with bash.  :-)\n\n-- \nShawn.\n"},{"id":"33879","messageId":"Pine.LNX.4.64.0702071525270.8424@woody.linux-foundation.org","threadId":"6729","inReplyTo":"7vd54l60gg.fsf@assigned-by-dhcp.cox.net","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-07T23:26:01Z","receivedAt":"2007-02-07T23:26:01Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n> >\n> > Of course, we should probably just have a\n> >\n> > \tgit reflog show\n> >\n> > command for this to make it prettier.\n> \n> \t$ git log -g?\n\nYou think that is *prettier*?\n\nNo, I think that if I want a log, I'll just do the \"less\", thank you very \nmuch ;)\n\n\t\tLinus\n"},{"id":"33880","messageId":"Pine.LNX.4.64.0702071526290.8424@woody.linux-foundation.org","threadId":"6729","inReplyTo":"17866.23050.937572.192253@lisa.zopyra.com","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-07T23:29:40Z","receivedAt":"2007-02-07T23:29:40Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 7 Feb 2007, Bill Lear wrote:\n> \n> Ah, I don't seem to have .git/logs at all.\n> \n> We plan to upgrade to 1.5 when it's out, so I guess we'll just\n> have to wait.\n\nEven with the git you have, you can probably just do a\n\n\tgit repo-config --global core.logallrefupdates true\n\nand you'll have reflogs enabled for all of your repositories (well, at \nleast the ones that share that home directory and thus ~/.gitconfig)\n\n\t\tLinus\n"},{"id":"33881","messageId":"17866.24904.961511.205102@lisa.zopyra.com","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071526290.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-07T23:31:20Z","receivedAt":"2007-02-07T23:31:20Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 7, 2007 at 15:29:40 (-0800) Linus Torvalds writes:\n>...\n>Even with the git you have, you can probably just do a\n>\n>\tgit repo-config --global core.logallrefupdates true\n>\n>and you'll have reflogs enabled for all of your repositories (well, at \n>least the ones that share that home directory and thus ~/.gitconfig)\n\nOk, this is good to know, thank you.\n\n\nBill\n"},{"id":"33882","messageId":"7vtzxx4k1c.fsf@assigned-by-dhcp.cox.net","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071525270.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-07T23:36:47Z","receivedAt":"2007-02-07T23:36:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Wed, 7 Feb 2007, Junio C Hamano wrote:\n>> >\n>> > Of course, we should probably just have a\n>> >\n>> > \tgit reflog show\n>> >\n>> > command for this to make it prettier.\n>> \n>> \t$ git log -g?\n>\n> You think that is *prettier*?\n>\n> No, I think that if I want a log, I'll just do the \"less\", thank you very \n> much ;)\n\nHeh, I do not care if you find \"log -g\" pretty, since I do not\nparticularly find it pretty (\"log --pretty=o --abbrev-commit -g\"\nis probably prettier than \"less\").\n\nI usually use \"show-branch -g\" myself while rewinding and\nrebuilding for a release, but my rewinds are lot more controlled\nthan \"oops, made a mistake\" recovery schenario that triggered\nthis discussion; for large logs (more than 25 entries) it is not\nvery useful.\n"},{"id":"33883","messageId":"Pine.LNX.4.64.0702071539390.8424@woody.linux-foundation.org","threadId":"6729","inReplyTo":"7vtzxx4k1c.fsf@assigned-by-dhcp.cox.net","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-07T23:46:32Z","receivedAt":"2007-02-07T23:46:32Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n> \n> Heh, I do not care if you find \"log -g\" pretty, since I do not\n> particularly find it pretty (\"log --pretty=o --abbrev-commit -g\"\n> is probably prettier than \"less\").\n\nWith \"--pretty=oneline --abbrev-commit\" I'll agree that it's actually \nfairly pretty.\n\nMaybe we can make \"-g\" default to that? As it is, I'd otherwise still use \n\"less\" just because there is less typing...\n\n\t\t\tLinus\n"},{"id":"33887","messageId":"eqdoql$4up$1@sea.gmane.org","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071539390.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-07T23:53:59Z","receivedAt":"2007-02-07T23:53:59Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Linus Torvalds wrote:\n> On Wed, 7 Feb 2007, Junio C Hamano wrote:\n>> \n>> Heh, I do not care if you find \"log -g\" pretty, since I do not\n>> particularly find it pretty (\"log --pretty=o --abbrev-commit -g\"\n>> is probably prettier than \"less\").\n> \n> With \"--pretty=oneline --abbrev-commit\" I'll agree that it's actually \n> fairly pretty.\n\nBy the way, --abbrev-commit is currently not documented...\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"33889","messageId":"Pine.LNX.4.63.0702080057140.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071539390.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-07T23:59:24Z","receivedAt":"2007-02-07T23:59:24Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Feb 2007, Linus Torvalds wrote:\n\n> On Wed, 7 Feb 2007, Junio C Hamano wrote:\n> > \n> > Heh, I do not care if you find \"log -g\" pretty, since I do not\n> > particularly find it pretty (\"log --pretty=o --abbrev-commit -g\"\n> > is probably prettier than \"less\").\n> \n> With \"--pretty=oneline --abbrev-commit\" I'll agree that it's actually \n> fairly pretty.\n> \n> Maybe we can make \"-g\" default to that? As it is, I'd otherwise still use \n> \"less\" just because there is less typing...\n\nI don't care either way. I'd even appreciate somebody harvesting the \nlow-hanging fruit of making \"git reflog show\" a wrapper to \"git log -p\".\n\nCiao,\nDscho\n\nP.S.: Sorry, Shawn, but I don't think that my version \"won\". It was \nmodeled after yours, but introduced flexibility to use reflog walking to \nother revision walkers. So, I think of it as the \"next\" version of your \n\"git reflog show\".\n"},{"id":"33891","messageId":"20070208000530.GA2469@spearce.org","threadId":"6729","inReplyTo":"Pine.LNX.4.63.0702080057140.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-02-08T00:05:30Z","receivedAt":"2007-02-08T00:05:30Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:\n> P.S.: Sorry, Shawn, but I don't think that my version \"won\". It was \n> modeled after yours, but introduced flexibility to use reflog walking to \n> other revision walkers. So, I think of it as the \"next\" version of your \n> \"git reflog show\".\n\nDon't be sorry. I think your -g reused more existing code than my\n`git reflog show` did, and you had the time to follow through on it\nwhen Junio was interested in a patch while I didn't.  It really did\nwin as the better solution for Git.  And that's all that matters. :-)\n\n-- \nShawn.\n"},{"id":"33900","messageId":"7v8xf94hq1.fsf@assigned-by-dhcp.cox.net","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071539390.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T00:26:46Z","receivedAt":"2007-02-08T00:26:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> With \"--pretty=oneline --abbrev-commit\" I'll agree that it's actually \n> fairly pretty.\n>\n> Maybe we can make \"-g\" default to that? As it is, I'd otherwise still use \n> \"less\" just because there is less typing...\n>\n> \t\t\tLinus\n\nWell, you would not know if the user gave you '-g' before you\nask setup_revisions() to parse the options, and once you let it\ndo its thing, you would not know if it also found an explicit\noutput format given by the end user, so your cannot sanely make\ndefault depend on '-g'.\n\nI suspect that it would have to be either somewhat involved or\noutright hacky.  \n\n---\n\n builtin-log.c |   15 ++++++++++++++-\n 1 files changed, 14 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 982d871..0221c76 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -22,8 +22,21 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,\n {\n \tint i;\n \n-\trev->abbrev = DEFAULT_ABBREV;\n \trev->commit_format = CMIT_FMT_DEFAULT;\n+\tif (!strcmp(argv[0], \"log\")) {\n+\t\t/* first see if there is \"-g\" */\n+\t\tfor (i = 1; i < argc; i++) {\n+\t\t\tif (!strcmp(\"--\", argv[i]))\n+\t\t\t\tbreak;\n+\t\t\tif (!strcmp(\"-g\", argv[i]) ||\n+\t\t\t    !strcmp(\"--walk-reflogs\", argv[i])) {\n+\t\t\t\trev->abbrev_commit = 1;\n+\t\t\t\trev->commit_format = CMIT_FMT_ONELINE;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t}\n+\trev->abbrev = DEFAULT_ABBREV;\n \trev->verbose_header = 1;\n \trev->show_root_diff = default_show_root;\n \targc = setup_revisions(argc, argv, rev, \"HEAD\");\n"},{"id":"33903","messageId":"Pine.LNX.4.63.0702080140230.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6729","inReplyTo":"7v8xf94hq1.fsf@assigned-by-dhcp.cox.net","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-08T00:41:39Z","receivedAt":"2007-02-08T00:41:39Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n\n> Linus Torvalds <torvalds@linux-foundation.org> writes:\n> \n> > With \"--pretty=oneline --abbrev-commit\" I'll agree that it's actually \n> > fairly pretty.\n> >\n> > Maybe we can make \"-g\" default to that? As it is, I'd otherwise still use \n> > \"less\" just because there is less typing...\n> >\n> > \t\t\tLinus\n> \n> Well, you would not know if the user gave you '-g' before you\n> ask setup_revisions() to parse the options, and once you let it\n> do its thing, you would not know if it also found an explicit\n> output format given by the end user, so your cannot sanely make\n> default depend on '-g'.\n> \n> I suspect that it would have to be either somewhat involved or\n> outright hacky.  \n\nWell, we could always make CMIT_FMT_DEFAULT _not_be the same as _MEDIUM, \nand if it still is the same _after_ parsing the options, set it to MEDIUM \nexplicitely. Same goes for the abbrev thing.\n\nCiao,\nDscho\n"},{"id":"33905","messageId":"7vmz3p321n.fsf@assigned-by-dhcp.cox.net","threadId":"6729","inReplyTo":"Pine.LNX.4.63.0702080140230.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T00:50:44Z","receivedAt":"2007-02-08T00:50:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> Well, you would not know if the user gave you '-g' before you\n>> ask setup_revisions() to parse the options, and once you let it\n>> do its thing, you would not know if it also found an explicit\n>> output format given by the end user, so your cannot sanely make\n>> default depend on '-g'.\n>> \n>> I suspect that it would have to be either somewhat involved or\n>> outright hacky.  \n>\n> Well, we could always make CMIT_FMT_DEFAULT _not_be the same as _MEDIUM, \n> and if it still is the same _after_ parsing the options, set it to MEDIUM \n> explicitely. Same goes for the abbrev thing.\n\nI think we are in agreement.  I showed an outright hacky one\nbecause I am not ready to do somewhat involved one at the end of\nthe rc period.\n"},{"id":"33906","messageId":"Pine.LNX.4.63.0702080155390.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6729","inReplyTo":"7vmz3p321n.fsf@assigned-by-dhcp.cox.net","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-08T00:56:01Z","receivedAt":"2007-02-08T00:56:01Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> >> Well, you would not know if the user gave you '-g' before you\n> >> ask setup_revisions() to parse the options, and once you let it\n> >> do its thing, you would not know if it also found an explicit\n> >> output format given by the end user, so your cannot sanely make\n> >> default depend on '-g'.\n> >> \n> >> I suspect that it would have to be either somewhat involved or\n> >> outright hacky.  \n> >\n> > Well, we could always make CMIT_FMT_DEFAULT _not_be the same as _MEDIUM, \n> > and if it still is the same _after_ parsing the options, set it to MEDIUM \n> > explicitely. Same goes for the abbrev thing.\n> \n> I think we are in agreement.  I showed an outright hacky one\n> because I am not ready to do somewhat involved one at the end of\n> the rc period.\n\nI fully agree. That's also why I am not pressing on other changes.\n\nCiao,\nDscho\n"},{"id":"33926","messageId":"45CADEBF.D1F286BD@eudaptics.com","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702071441160.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Johannes Sixt","fromEmail":"j.sixt@eudaptics.com","sentAt":"2007-02-08T08:26:39Z","receivedAt":"2007-02-08T08:26:39Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Linus Torvalds wrote:\n> \n> On Wed, 7 Feb 2007, Bill Lear wrote:\n> >\n> > I thought that it would be very useful to have a history of git\n> > commands that have been run against a repo, in order to hopefully\n> > debug this sort of thing --- perhaps only those that modify the repo.\n> \n> The \"reflog\" is kind of that, and you can literally do\n> \n>         less .git/logs/refs/heads/master\n> \n> to get some kind of idea what's up.\n\nOr something like this:\n\nfind .git/logs -type f | xargs cat | sort -t'>' -k2 -n | less\n\n-- Hannes\n"},{"id":"33948","messageId":"Pine.LNX.4.64.0702080948240.8424@woody.linux-foundation.org","threadId":"6729","inReplyTo":"7vmz3p321n.fsf@assigned-by-dhcp.cox.net","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-02-08T17:51:56Z","receivedAt":"2007-02-08T17:51:56Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 7 Feb 2007, Junio C Hamano wrote:\n> \n> I think we are in agreement.  I showed an outright hacky one\n> because I am not ready to do somewhat involved one at the end of\n> the rc period.\n\nHow about this?\n\nIt makes \"git reflog [show]\" act as\n\n\tgit log -g --pretty=oneline --abbrev-cmit\n\nand is fairly straightforward. So you can just write\n\n\tgit reflog\n\nor \n\n\tgit reflog show\n\nand it will show you the reflog in a nice format.\n\n\t\tLinus\n\n---\n Documentation/git-reflog.txt |   17 +++++++++++++----\n builtin-log.c                |   32 ++++++++++++++++++++++++++++++++\n builtin-reflog.c             |   18 ++++++++++++------\n builtin.h                    |    1 +\n 4 files changed, 58 insertions(+), 10 deletions(-)\n\ndiff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\ndiff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt\nindex 1138865..bc7c987 100644\n--- a/Documentation/git-reflog.txt\n+++ b/Documentation/git-reflog.txt\n@@ -8,13 +8,18 @@ git-reflog - Manage reflog information\n \n SYNOPSIS\n --------\n-[verse]\n-'git-reflog' expire [--dry-run] [--stale-fix]\n-\t[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...\n-\n+'git reflog' <subcommand> <options> \n \n DESCRIPTION\n -----------\n+The command takes various subcommands, and different options\n+depending on the subcommand:\n+\n+[verse]\n+git reflog expire [--dry-run] [--stale-fix]\n+\t[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...\n+\n+git reflog [show] [log-options]\n \n Reflog is a mechanism to record when the tip of branches are\n updated.  This command is to manage the information recorded in it.\n@@ -25,6 +30,10 @@ Entries older than `expire` time, or entries older than\n tip, are removed from the reflog.  This is typically not used\n directly by the end users -- instead, see gitlink:git-gc[1].\n \n+The subcommand \"show\" (which is also the default, in the absense of any\n+subcommands) will take all the normal log options, and show the log of\n+the current branch. It is basically an alias for 'git log -g --abbrev-commit\n+--pretty=oneline', see gitlink:git-log[1].\n \n \n OPTIONS\ndiff --git a/builtin-log.c b/builtin-log.c\nindex 982d871..af2de54 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -11,6 +11,7 @@\n #include \"log-tree.h\"\n #include \"builtin.h\"\n #include \"tag.h\"\n+#include \"reflog-walk.h\"\n \n static int default_show_root = 1;\n \n@@ -181,6 +182,37 @@ int cmd_show(int argc, const char **argv, const char *prefix)\n \treturn ret;\n }\n \n+/*\n+ * This is equivalent to \"git log -g --abbrev-commit --pretty=oneline\"\n+ */\n+int cmd_log_reflog(int argc, const char **argv, const char *prefix)\n+{\n+\tstruct rev_info rev;\n+\n+\tgit_config(git_log_config);\n+\tinit_revisions(&rev, prefix);\n+\tinit_reflog_walk(&rev.reflog_info);\n+\trev.abbrev_commit = 1;\n+\trev.verbose_header = 1;\n+\tcmd_log_init(argc, argv, prefix, &rev);\n+\n+\t/*\n+\t * This means that we override whatever commit format the user gave\n+\t * on the cmd line.  Sad, but cmd_log_init() currently doesn't\n+\t * allow us to set a different default.\n+\t */\n+\trev.commit_format = CMIT_FMT_ONELINE;\n+\trev.always_show_header = 1;\n+\n+\t/*\n+\t * We get called through \"git reflog\", so unlike the other log\n+\t * routines, we need to set up our pager manually..\n+\t */\n+\tsetup_pager();\n+\n+\treturn cmd_log_walk(&rev);\n+}\n+\n int cmd_log(int argc, const char **argv, const char *prefix)\n {\n \tstruct rev_info rev;\ndiff --git a/builtin-reflog.c b/builtin-reflog.c\nindex bfb169a..65b845b 100644\n--- a/builtin-reflog.c\n+++ b/builtin-reflog.c\n@@ -13,7 +13,7 @@\n  */\n \n static const char reflog_expire_usage[] =\n-\"git-reflog expire [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...\";\n+\"git-reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...\";\n \n static unsigned long default_reflog_expire;\n static unsigned long default_reflog_expire_unreachable;\n@@ -372,10 +372,16 @@ static const char reflog_usage[] =\n \n int cmd_reflog(int argc, const char **argv, const char *prefix)\n {\n-\tif (argc < 2)\n-\t\tusage(reflog_usage);\n-\telse if (!strcmp(argv[1], \"expire\"))\n+\t/* With no command, we default to showing it. */\n+\tif (argc < 2 || *argv[1] == '-')\n+\t\treturn cmd_log_reflog(argc, argv, prefix);\n+\n+\tif (!strcmp(argv[1], \"show\"))\n+\t\treturn cmd_log_reflog(argc - 1, argv + 1, prefix);\n+\n+\tif (!strcmp(argv[1], \"expire\"))\n \t\treturn cmd_reflog_expire(argc - 1, argv + 1, prefix);\n-\telse\n-\t\tusage(reflog_usage);\n+\n+\t/* Not a recognized reflog command..*/\n+\tusage(reflog_usage);\n }\ndiff --git a/builtin.h b/builtin.h\nindex dd0e352..5108fd2 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -40,6 +40,7 @@ extern int cmd_grep(int argc, const char **argv, const char *prefix);\n extern int cmd_help(int argc, const char **argv, const char *prefix);\n extern int cmd_init_db(int argc, const char **argv, const char *prefix);\n extern int cmd_log(int argc, const char **argv, const char *prefix);\n+extern int cmd_log_reflog(int argc, const char **argv, const char *prefix);\n extern int cmd_ls_files(int argc, const char **argv, const char *prefix);\n extern int cmd_ls_tree(int argc, const char **argv, const char *prefix);\n extern int cmd_mailinfo(int argc, const char **argv, const char *prefix);\n"},{"id":"33951","messageId":"Pine.LNX.4.63.0702081934300.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6729","inReplyTo":"Pine.LNX.4.64.0702080948240.8424@woody.linux-foundation.org","subject":"Re: Git log of all (modifying) commands run on a repo?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-08T18:36:58Z","receivedAt":"2007-02-08T18:36:58Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 8 Feb 2007, Linus Torvalds wrote:\n\n> On Wed, 7 Feb 2007, Junio C Hamano wrote:\n> > \n> > I think we are in agreement.  I showed an outright hacky one\n> > because I am not ready to do somewhat involved one at the end of\n> > the rc period.\n> \n> How about this?\n>\n> [...]\n> \n>  Documentation/git-reflog.txt |   17 +++++++++++++----\n\nWow: documentation by Linus! ;-)\n\n> diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt\n> diff --git a/Documentation/git-reflog.txt b/Documentation/git-reflog.txt\n\nNot using commit & format-patch?\n\n> index 1138865..bc7c987 100644\n> --- a/Documentation/git-reflog.txt\n> +++ b/Documentation/git-reflog.txt\n> @@ -8,13 +8,18 @@ git-reflog - Manage reflog information\n>  \n>  SYNOPSIS\n>  --------\n> -[verse]\n> -'git-reflog' expire [--dry-run] [--stale-fix]\n> -\t[--expire=<time>] [--expire-unreachable=<time>] [--all] <refs>...\n> -\n> +'git reflog' <subcommand> <options> \n\nThis line has white space at the end.\n\nBesides those (TIC) comments, I also have this one: Looks good to me!\n\nCiao,\nDscho\n"}]}