{"thread":{"id":"6742","subject":"Question on git fetch to bare repo","startedAt":"2007-02-08T22:28:29Z","lastAt":"2007-02-13T05:31:03Z","messageCount":10,"participants":["Bill Lear","Jakub Narebski","Johannes Schindelin","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"33990","messageId":"17867.41997.561756.679778@lisa.zopyra.com","threadId":"6742","inReplyTo":null,"subject":"Question on git fetch to bare repo","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-08T22:28:29Z","receivedAt":"2007-02-08T22:28:29Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"If I have not yet made myself unwelcome, I now have another problem\nusing git 1.4.4.1.\n\nI have a public bare repo I created yesterday:\n\n% mkdir project && cd project\n% git --bare init-db --shared\n% git --bare fetch git://source/project\n[All seems well]\n\nI have a private repo:\n\n% mkdir project && cd project\n% git clone /repos/git/project\n[All is well]\n\nA co-worker checks something in to our company repo, so I go to my\npublic repo to fetch the changes:\n\n% cd /repos/git/project\n% git --bare fetch -v git://source/project\nremote: Generating pack...\nremote: Done counting 230 objects.\nremote: Result has 152 objects.\nremote: Deltifying 152 objects.\nremote:  100% (152/152) done\nUnpacking 152 objects\nremote: Total 152, written 152 (delta 109), reused 90 (delta 51)\n 100% (152/152) done\n* fetched git://source/project\n  commit: 5c2d43d\n\nI then go to my private repo to pull from my public one:\n\n% cd ~/project\n% git branch\n  topic\n* master\n% git pull\nAlready up-to-date.\n% cat .git/remotes/origin\nURL: /repos/git/project\nPull: refs/heads/master:refs/heads/origin\nPull: refs/heads/topic:refs/heads/topic\n[All seems well with this repo ??]\n\nI try to push from my private to my public:\n\n% git push /repos/git/project\nEverything up-to-date\n\nI go back to my public repo, and poking around, can't see what is wrong.\n\nThe commit that the fetch says it pulled is there, if I do:\n\n% cd /repos/git/project\n% git --bare show -t 5c2d43d\n\nthe patch comes out exactly as it did in my email notification, so I\nknow it's there.\n\nI tried then to be more forceful, and did another fetch like this,\nwhich I sort of expected to fail:\n\n% git --bare fetch -v git://source/project master:master\nremote: Generating pack...\nremote: Done counting 230 objects.\nremote: Result has 152 objects.\nremote: Deltifying 152 objects.\nremote:  100% (152/152) done\nUnpacking 152 objects\nremote: Total 152, written 152 (delta 109), reused 90 (delta 51)\n 100% (152/152) done\n* refs/heads/master: fast forward to branch 'master' of git://source/project\n  old..new: 37e2298..5c2d43d\nCannot fetch into the current branch.\n\nHaving enabled the logs, I can investigate a bit:\n\n% cat logs/refs/heads/master\n37e229835103a11365b1e081f9b9987a88437e62 5c2d43dc819fc1bc37ebae1696c3fbfd6a4401db Bill Lear <rael@zopyra.com> 1170973321 -0600     fetch git://source/project: fast-forward\n5c2d43dc819fc1bc37ebae1696c3fbfd6a4401db 37e229835103a11365b1e081f9b9987a88437e62 Bill Lear <rael@zopyra.com> 1170973321 -0600     fetch git://source/project: Undoing incorrectly fetched HEAD.\n\nAnd, my branches seem to be there, properly:\n\n% git --bare branch\n  topic\n* master\n\nSo, I'm confused.  Why does my fetch seem to fetch things the first\ntime, yet I cannot pull these into my private repo?  I could swear I\njust did this same sequence of operations on Monday and it worked.\n\nPerhaps I just need a vacation ...\n\n\nBill\n"},{"id":"33993","messageId":"eqg8fa$ru3$1@sea.gmane.org","threadId":"6742","inReplyTo":"17867.41997.561756.679778@lisa.zopyra.com","subject":"Re: Question on git fetch to bare repo","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-08T22:34:53Z","receivedAt":"2007-02-08T22:34:53Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Bill Lear wrote:\n\n> I have a public bare repo I created yesterday:\n> \n> % mkdir project && cd project\n> % git --bare init-db --shared\n> % git --bare fetch git://source/project\n> [All seems well]\n\n_Seems_ well\n\n  % git clone --bare --shared git://source/project project\n\nis a proper invocation.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"34018","messageId":"Pine.LNX.4.63.0702090119070.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6742","inReplyTo":"eqg8fa$ru3$1@sea.gmane.org","subject":"Re: Question on git fetch to bare repo","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-09T00:22:45Z","receivedAt":"2007-02-09T00:22:45Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\n[Jakub, you broke the thread. I Cc' Bill, but I cannot join the thread]\n\nOn Thu, 8 Feb 2007, Jakub Narebski wrote:\n\n> Bill Lear wrote:\n> \n> > I have a public bare repo I created yesterday:\n> > \n> > % mkdir project && cd project\n> > % git --bare init-db --shared\n> > % git --bare fetch git://source/project\n> > [All seems well]\n> \n> _Seems_ well\n> \n>   % git clone --bare --shared git://source/project project\n> \n> is a proper invocation.\n\nNo.\n\ninit --shared means that the repository is set up such that different \nusers can update branches.\n\nclone --shared means that if the original repository is on the local \nmachine (which it is not in your example), then that is used as an \nalternate, i.e. the objects are not copied at all, but reused from the \nother location.\n\nI complained about that ambiguity, but I am probably the guilty person: \nAFAIR it was me who introduced \"init --shared\".\n\nCiao,\nDscho\n"},{"id":"34019","messageId":"Pine.LNX.4.63.0702090123350.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6742","inReplyTo":"Pine.LNX.4.63.0702090119070.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: Question on git fetch to bare repo","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-09T00:24:14Z","receivedAt":"2007-02-09T00:24:14Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 9 Feb 2007, Johannes Schindelin wrote:\n\n> [Jakub, you broke the thread. I Cc' Bill, but I cannot join the thread]\n\nSorry, PEBCAK. The thread is not broken, but you -- again -- did not reply \nto the original poster.\n\nCiao,\nDscho\n"},{"id":"34031","messageId":"20070209023941.GE10574@coredump.intra.peff.net","threadId":"6742","inReplyTo":"17867.41997.561756.679778@lisa.zopyra.com","subject":"Re: Question on git fetch to bare repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-02-09T02:39:41Z","receivedAt":"2007-02-09T02:39:41Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Feb 08, 2007 at 04:28:29PM -0600, Bill Lear wrote:\n\n> % mkdir project && cd project\n> % git --bare init-db --shared\n> % git --bare fetch git://source/project\n> [All seems well]\n\nIt's not. You have fetched the objects from git://source/project, and\nFETCH_HEAD (an ephemeral pointer to the things you just fetched) points\nto them. But look in project/refs/heads; you have no branches!\n\nWhat you want instead is:\n  git --bare fetch git://source/project master:master\nwhich means\n  \"fetch project's master and store it as my master; if it's not a\n  fast-forward, then complain loudly. Don't do any merges.\"\n\n> I have a private repo:\n> \n> % mkdir project && cd project\n> % git clone /repos/git/project\n> [All is well]\n\nIs it? You shouldn't have any branches in /repos/git/project at this\npoint.\n\n> A co-worker checks something in to our company repo, so I go to my\n> public repo to fetch the changes:\n> \n> % cd /repos/git/project\n> % git --bare fetch -v git://source/project\n> remote: Generating pack...\n> remote: Done counting 230 objects.\n> remote: Result has 152 objects.\n> remote: Deltifying 152 objects.\n> remote:  100% (152/152) done\n> Unpacking 152 objects\n> remote: Total 152, written 152 (delta 109), reused 90 (delta 51)\n>  100% (152/152) done\n> * fetched git://source/project\n>   commit: 5c2d43d\n\nAgain, you're not _storing_ those changes in a branch, you're just\nputting them in FETCH_HEAD.\n\n> I then go to my private repo to pull from my public one:\n> \n> % cd ~/project\n> % git branch\n>   topic\n> * master\n> % git pull\n> Already up-to-date.\n\nNot surprising, since you didn't actually update any branches in the\nprevious step.\n\n> % cat .git/remotes/origin\n> URL: /repos/git/project\n> Pull: refs/heads/master:refs/heads/origin\n> Pull: refs/heads/topic:refs/heads/topic\n> [All seems well with this repo ??]\n\nI'm confused as to how there are branches in the 'public' repo at this\nstep, since your initial fetch shouldn't have actually made any,\nespecially not a 'topic' branch.\n\n> % cd /repos/git/project\n> % git --bare show -t 5c2d43d\n> \n> the patch comes out exactly as it did in my email notification, so I\n> know it's there.\n\nSure, you have the object, but you don't have any _pointers_ to it.\n\n> I tried then to be more forceful, and did another fetch like this,\n> which I sort of expected to fail:\n> \n> % git --bare fetch -v git://source/project master:master\n> remote: Generating pack...\n> remote: Done counting 230 objects.\n> remote: Result has 152 objects.\n> remote: Deltifying 152 objects.\n> remote:  100% (152/152) done\n> Unpacking 152 objects\n> remote: Total 152, written 152 (delta 109), reused 90 (delta 51)\n>  100% (152/152) done\n> * refs/heads/master: fast forward to branch 'master' of git://source/project\n>   old..new: 37e2298..5c2d43d\n> Cannot fetch into the current branch.\n\nYou're more on the right track here, but not quite. If you want to save\nthings in branches, you either need to use a 'remotes' shorthand (which\ndefines pull lines with refspecs) or you need to specify the refspec on\nthe command line (like master:master). However, you _don't_ want to\nfetch directly into your master branch. fetch is for copying refs and\nobjects, not for merging (and you've presumably made some commits on\nmaster that the upstream doesn't have).\n\nIt seems like you're trying to merge in your \"public\" repository, which\nis a mistake. I think you would be much better served to think of your\npublic repository as a place where you publish changes (_only_ from your\nprivate repository), and do all of your external fetching and merging in\nyour private repository. Everyone has a public repo, so you always\n\"pull\" from other people's public repos, and \"push\" into your public\nrepo. Thus you don't need --shared at all.\n\nIOW, do this:\n\n# set up public repository; initially empty, but we will push something\n# useful into it soon.\nmkdir /git/repo/project && cd /git/repo/project\ngit --bare init\n\n# set up our private repository, which is a clone of the company repo\ncd $HOME\ngit clone git://source/project\n\n# at this point, our .git/remotes/origin file is set up to pull from\n# the company repo. But we still want to publish our changes in our\n# personal public repo. Let's set that up. We always want the public\n# branches to match ours, even if we've reset or rebased, so we use '+'\n# to always overwrite. This is safe, because data is never getting into\n# the public repo in any way _except_ for us pushing it.\ncat >.git/remotes/publish <<'EOF'\nURL: /git/repo/project\nPush: +master:master\nPush: +topic:topic\n\n# now we can make our first publication, which at this point is the same\n# as the source repo\ngit push publish\n\n# and now we make some changes\nhack hack hack\ngit commit\n\n# and we can publish more changes\ngit push publish\n\n# but now we want to grab some changes from Bob's public repo. Let's set\n# up a new remote for him. Again, we use '+' to overwrite, since we are\n# just tracking what Bob is doing. Note that we have Bob's branch now,\n# but we don't _publish_ it, since it's not in our publish remote.\ncat >.git/remotes/bob <<'EOF'\nURL: /path/to/bobs/repo\nPull: +master:bob-master\nEOF\n\n# and now we can fetch/pull from bob\ngit fetch bob\n# what has bob done that we haven't?\ngitk bob-master..master\n# ok, let's merge\ngit pull . bob-master\n# or do the fetch/pull in one step\ngit pull bob master\n\nAnd Bob can of course do the same to us.\n\nDoes that make more sense? Or have I completely missed what you are\ntrying to accomplish? :)\n\n-Peff\n"},{"id":"34034","messageId":"17867.63080.573849.552617@lisa.zopyra.com","threadId":"6742","inReplyTo":"20070209023941.GE10574@coredump.intra.peff.net","subject":"Re: Question on git fetch to bare repo","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-09T04:19:52Z","receivedAt":"2007-02-09T04:19:52Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Thursday, February 8, 2007 at 21:39:41 (-0500) Jeff King writes:\n>...\n>Does that make more sense? Or have I completely missed what you are\n>trying to accomplish? :)\n\nNo, you haven't misunderstood.  This gives me yet more options, so\nthank you very much.\n\n\nBill\n"},{"id":"34317","messageId":"17872.53830.887188.137662@lisa.zopyra.com","threadId":"6742","inReplyTo":"20070209023941.GE10574@coredump.intra.peff.net","subject":"Re: Question on git fetch to bare repo","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-12T20:47:02Z","receivedAt":"2007-02-12T20:47:02Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Thursday, February 8, 2007 at 21:39:41 (-0500) Jeff King writes:\n>...\n>You're more on the right track here, but not quite. If you want to save\n>things in branches, you either need to use a 'remotes' shorthand (which\n>defines pull lines with refspecs) or you need to specify the refspec on\n>the command line (like master:master). However, you _don't_ want to\n>fetch directly into your master branch. fetch is for copying refs and\n>objects, not for merging (and you've presumably made some commits on\n>master that the upstream doesn't have).\n>\n>It seems like you're trying to merge in your \"public\" repository, which\n>is a mistake. I think you would be much better served to think of your\n>public repository as a place where you publish changes (_only_ from your\n>private repository), and do all of your external fetching and merging in\n>your private repository. Everyone has a public repo, so you always\n>\"pull\" from other people's public repos, and \"push\" into your public\n>repo. Thus you don't need --shared at all.\n\nOk, I've gotten some time to read through this.  Kinda sad that\nsomething published 4 days ago seems like the distant past ...\n\nThe problem I have with doing all of my fetching and merging in my\nprivate repo is this: I have an update hook in my public repo that I\nuse to communicate my changes to my peers.  The problem is when I pull\nfrom a peer's repo into my private repo, make some of my changes, and\nthen publish (push) my changes to the public repo, HIS changes are\npushed as well, and the update script naturally picks up on these and\nbroadcasts them.  My peer group ends up getting the same update\nmessage about his commits that they have already received.  Multiply\nthis among 6 peers and it becomes a real headache.\n\nOn the other hand, if I fetch his changes into my public (bare) repo\nfirst, and then pull from there into my private, make changes in my\nprivate and then commit and publish to my public, the update script\nwill send out my changes --- and only MY changes --- to my peers.\n\nSo, what I have (just now) tried to do (using the latest 1.5 code),\nis clone my public repo to create my private repo:\n\n% git clone /repos/git/project\n\nand my .git/config file is now:\n\n% cat .git/config\n[core]\n        repositoryformatversion = 0\n        filemode = true\n        bare = false\n        logallrefupdates = true\n[remote \"origin\"]\n        url = /repos/git/project\n        fetch = +refs/heads/*:refs/remotes/origin/*\n[branch \"master\"]\n        remote = origin\n        merge = refs/heads/master\n\nand no .git/remotes/origin exists.\n\nI notice that this did not \"clone\" all the branches in my public repo:\n\n% git branch\n* master\n\nwhereas in my public repo:\n\n% cd /repos/git/project\n% git --bare branch\n  topic\n* master\n\nSo, regardless if I can correct that (very confused as to why the\nclone did not grab the branch), it seems that I did not make my intent\nclear...\n\nI'm still not sure if I'm obeying the \"don't develop on anything\non the RHS of ':' dictum\".\n\nI'm going to puzzle over the rest of your advice to see if I can\ngrok it and fold it into the new (1.5) way of life.\n\n\nBill\n"},{"id":"34371","messageId":"20070213045441.GA328@coredump.intra.peff.net","threadId":"6742","inReplyTo":"17872.53830.887188.137662@lisa.zopyra.com","subject":"Re: Question on git fetch to bare repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-02-13T04:54:42Z","receivedAt":"2007-02-13T04:54:42Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 12, 2007 at 02:47:02PM -0600, Bill Lear wrote:\n\n> The problem I have with doing all of my fetching and merging in my\n> private repo is this: I have an update hook in my public repo that I\n> use to communicate my changes to my peers.  The problem is when I pull\n> from a peer's repo into my private repo, make some of my changes, and\n> then publish (push) my changes to the public repo, HIS changes are\n> pushed as well, and the update script naturally picks up on these and\n> broadcasts them.  My peer group ends up getting the same update\n> message about his commits that they have already received.  Multiply\n> this among 6 peers and it becomes a real headache.\n\nInteresting. Why not have your update hook know who you are, and send\nout changes only for commits that are either authored by you, or\ncommitted by you (depending on your workflow, these may have different\nresults)?\n\nSomething like this (mostly untested!) on top of the stock update hook:\n\ndiff --git a/templates/hooks--update b/templates/hooks--update\nindex d4253cb..1598f1b 100644\n--- a/templates/hooks--update\n+++ b/templates/hooks--update\n@@ -55,6 +55,7 @@ projectdesc=$(cat $GIT_DIR/description)\n recipients=$(git-repo-config hooks.mailinglist)\n announcerecipients=$(git-repo-config hooks.announcelist)\n allowunannotated=$(git-repo-config --bool hooks.allowunannotated)\n+authorfilter=$(git-repo-config hooks.authorfilter)\n \n # --- Check types\n newrev_type=$(git-cat-file -t \"$newrev\")\n@@ -148,7 +149,7 @@ case \"$refname_type\" in\n \t\t\t# This shows all log entries that are not already covered by\n \t\t\t# another ref - i.e. commits that are now accessible from this\n \t\t\t# ref that were previously not accessible\n-\t\t\tgit-rev-list --pretty $newref $(git-rev-parse --not --all)\n+\t\t\tgit-rev-list ${authorfilter:+--author=\"$authorfilter\"} --pretty $newref $(git-rev-parse --not --all)\n \t\t\techo $LOGEND\n \t\telse\n \t\t\t# oldrev is valid\n@@ -165,7 +166,7 @@ case \"$refname_type\" in\n \t\t\tbaserev=$(git-merge-base $oldrev $newrev)\n \n \t\t\t# Commit with a parent\n-\t\t\tfor rev in $(git-rev-list $newrev ^$baserev)\n+\t\t\tfor rev in $(git-rev-list ${authorfilter:+--author=\"$authorfilter\"} $newrev ^$baserev)\n \t\t\tdo\n \t\t\t\trevtype=$(git-cat-file -t \"$rev\")\n \t\t\t\techo \"       via  $rev ($revtype)\"\n@@ -190,7 +191,7 @@ case \"$refname_type\" in\n \t\t\tfi\n \t\t\techo \"\"\n \t\t\techo $LOGBEGIN\n-\t\t\tgit-rev-list --pretty $newrev ^$baserev\n+\t\t\tgit-rev-list ${authorfilter:+--author=\"$authorfilter\"} --pretty $newrev ^$baserev\n \t\t\techo $LOGEND\n \t\t\techo \"\"\n \t\t\techo \"Diffstat:\"\n\n\nJust set hooks.authorfilter in your config to 'Bill Lear'.  Note that\nthis still gives the _full_ diffstat between the two endpoints. I would\nthink you would really want to show a diffstat for each filtered commit\nindividually. And you're probably not using this hook currently, but I\nhope it should be obvious how to modify whatever you are using.\n\nOf course, what you're doing now isn't _wrong_, once we fix the\n\"committing on tracking branches\" problem (which it looks like you are\naddressing below), so don't let me drag you too far from your workflow.\n:)\n\n> So, what I have (just now) tried to do (using the latest 1.5 code),\n\nGood, 1.5 is much more pleasant to work with. :)\n\n> [remote \"origin\"]\n>         url = /repos/git/project\n>         fetch = +refs/heads/*:refs/remotes/origin/*\n\nSo this means everything in your public repo's refs/heads/* is mirrored\nin your private refs/remotes/origin/*.\n\n> [branch \"master\"]\n>         remote = origin\n>         merge = refs/heads/master\n\nAnd the local branch master will merge from origin's refs/heads/master.\n\n> and no .git/remotes/origin exists.\n\nRight, the config above supersedes it.\n\n> I notice that this did not \"clone\" all the branches in my public repo:\n> \n> % git branch\n> * master\n> \n> whereas in my public repo:\n> \n> % cd /repos/git/project\n> % git --bare branch\n>   topic\n> * master\n\nIt did clone it; git-branch just doesn't print remote branches by\ndefault. Try 'git branch -a'. You can create a new topic branch from\nyour origin topic branch like this:\n\n  git checkout -b topic origin/topic\n\nIf you want it to pull automagically from the upstream topic (when you\ndo a git-pull without any arguments), then you need a config similar to\nwhat it automatically set up for master:\n\n  [branch \"topic\"]\n    remote = origin\n    merge = refs/heads/topic\n\n> I'm still not sure if I'm obeying the \"don't develop on anything\n> on the RHS of ':' dictum\".\n\nYou are, because 1.5 makes it much harder to do so. Doing a\n'git-checkout topic' won't work until you create a local topic branch.\nWith the detached head work in 1.5, you _can_ do this:\n\n  git checkout origin/topic\n\nbut it will issue a warning.\n\n-Peff\n"},{"id":"34375","messageId":"7vejou39ud.fsf@assigned-by-dhcp.cox.net","threadId":"6742","inReplyTo":"17872.53830.887188.137662@lisa.zopyra.com","subject":"Re: Question on git fetch to bare repo","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-13T05:28:10Z","receivedAt":"2007-02-13T05:28:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> The problem I have with doing all of my fetching and merging in my\n> private repo is this: I have an update hook in my public repo that I\n> use to communicate my changes to my peers.  The problem is when I pull\n> from a peer's repo into my private repo, make some of my changes, and\n> then publish (push) my changes to the public repo, HIS changes are\n> pushed as well, and the update script naturally picks up on these and\n> broadcasts them.  My peer group ends up getting the same update\n> message about his commits that they have already received.  Multiply\n> this among 6 peers and it becomes a real headache.\n\nI suspect that is because your \"email when pushed\" hook lists\nwhat commits are new on the branch.  I do not use any \"email\nwhen pushed\" hook myself, so I do not know how yours is set up,\nbut I suspect it is doing a moral equivalent of:\n\n\t#!/bin/sh\n\tname=<name of the branch the email will talk about>\n\told=<commit before this push updates the branch tip>\n        new=<commit this push is trying to update the branch tip with>\n\n\tgit shortlog $old..$new |\n        mailx -s \"branch $name updated\" recipients\n\nThat behaviour might be desirable when branches in the\nrepositories are more or less independent, but in situations\nlike yours where commit are cross pushed into each other's\nbranches, you are not necessarily interested in the progress of\neach branch.\n\nOne solution would be to list only the new commits introduced by\nthe push into the repository, regardless of the branch.  You can\nreplace the \"git-shortlog $old..$new\" with:\n\n\tgit shortlog $new --not --all\n\nto get that information, I think.\n"},{"id":"34376","messageId":"20070213053103.GA3795@coredump.intra.peff.net","threadId":"6742","inReplyTo":"7vejou39ud.fsf@assigned-by-dhcp.cox.net","subject":"Re: Question on git fetch to bare repo","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-02-13T05:31:03Z","receivedAt":"2007-02-13T05:31:03Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Feb 12, 2007 at 09:28:10PM -0800, Junio C Hamano wrote:\n\n> One solution would be to list only the new commits introduced by\n> the push into the repository, regardless of the branch.  You can\n> replace the \"git-shortlog $old..$new\" with:\n> \n> \tgit shortlog $new --not --all\n> \n> to get that information, I think.\n\nI don't think that addresses his concern. I had suggested to him that he\ndo all pulling/merging in his private repo, then simply keep the public\nrepo as a mirror. In that case, when pushing out to the public repo,\n_all_ commits will likely be new to the public repo, including those\nones that he pulled from elsewhere.\n\n-Peff\n"}]}