{"thread":{"id":"9394","subject":"How to figure out what 'git push' would do?","startedAt":"2007-08-05T11:37:34Z","lastAt":"2007-08-05T22:09:02Z","messageCount":6,"participants":["Steffen Prohaska","David Kastrup","Alex Riesen","Julian Phillips"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"49868","messageId":"267CDD46-549B-4BFE-B993-80CD1CFE75D8@zib.de","threadId":"9394","inReplyTo":null,"subject":"How to figure out what 'git push' would do?","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-05T11:37:34Z","receivedAt":"2007-08-05T11:37:34Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"How can I check what a 'git push' would do, without\nactually doing it?\n\nIs there something like 'git push --dry-run', similar\nto 'rsync --dry-run'?\n\n\tSteffen\n"},{"id":"49870","messageId":"85ps228ax2.fsf@lola.goethe.zz","threadId":"9394","inReplyTo":"267CDD46-549B-4BFE-B993-80CD1CFE75D8@zib.de","subject":"Re: How to figure out what 'git push' would do?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-05T11:42:49Z","receivedAt":"2007-08-05T11:42:49Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Steffen Prohaska <prohaska@zib.de> writes:\n\n> How can I check what a 'git push' would do, without\n> actually doing it?\n>\n> Is there something like 'git push --dry-run', similar\n> to 'rsync --dry-run'?\n\nWel, you could put\n\n#!/bin/sh\ncat >/tmp/dryrun\nexit 1\n\ninto\n\n$GIT_DIR/hooks/pre-receive\n\non the receiving side.  Or maybe the update hook.\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49916","messageId":"20070805173340.GA3159@steel.home","threadId":"9394","inReplyTo":"267CDD46-549B-4BFE-B993-80CD1CFE75D8@zib.de","subject":"Re: How to figure out what 'git push' would do?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-05T17:33:40Z","receivedAt":"2007-08-05T17:33:40Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Steffen Prohaska, Sun, Aug 05, 2007 13:37:34 +0200:\n> How can I check what a 'git push' would do, without\n> actually doing it?\n> \n> Is there something like 'git push --dry-run', similar\n> to 'rsync --dry-run'?\n\nNo. It is often safe to just do git-push, unless you have naive\ndevelopers doing pull every time some ref in your shared repo changes\n*and* expecting the result to compile (typical for CVS way of work).\ngit-push will not overwrite anything, it always only forwards history.\n\nFor the case you really want to know what the changes on remote repo\nwill be it is possible to fetch them into the local repo first and\ncompare with what you will push:\n\n    $ git fetch git://remote/path/REPO master:refs/remotes/REPO/master\n    $ gitk local..REPO/master\n\nIt gives you all possible information, which may be worth that bit of\nwork. Or, if you have all the remote configuration ready, it can be\njust:\n\n    $ git fetch\n    $ gitk local..REPO/master\n"},{"id":"49917","messageId":"Pine.LNX.4.64.0708051839510.12656@beast.quantumfyre.co.uk","threadId":"9394","inReplyTo":"20070805173340.GA3159@steel.home","subject":"Re: How to figure out what 'git push' would do?","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-08-05T17:45:41Z","receivedAt":"2007-08-05T17:45:41Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Sun, 5 Aug 2007, Alex Riesen wrote:\n\n> Steffen Prohaska, Sun, Aug 05, 2007 13:37:34 +0200:\n>> How can I check what a 'git push' would do, without\n>> actually doing it?\n>>\n>> Is there something like 'git push --dry-run', similar\n>> to 'rsync --dry-run'?\n>\n> No. It is often safe to just do git-push, unless you have naive\n> developers doing pull every time some ref in your shared repo changes\n> *and* expecting the result to compile (typical for CVS way of work).\n> git-push will not overwrite anything, it always only forwards history.\n\nNot strictly true.  You _can_ push out non fastforward changes, unless you \nhave receive.denyNonFastforwards in the repote repo - so you may well be \nable to push out something that is completely unrelated to the last commit \nthe ref pointed to.\n\n-- \nJulian\n\n  ---\nYou never get a second chance to make a first impression.\n"},{"id":"49936","messageId":"515E28B6-85AF-4379-870A-CFECF19B74DE@zib.de","threadId":"9394","inReplyTo":"20070805173340.GA3159@steel.home","subject":"Re: How to figure out what 'git push' would do?","fromName":"Steffen Prohaska","fromEmail":"prohaska@zib.de","sentAt":"2007-08-05T19:56:37Z","receivedAt":"2007-08-05T19:56:37Z","isPatch":false,"sender":{"key":"prohaska@zib.de","avatar":"https://avatars.githubusercontent.com/u/217580?v=4"},"body":"\nOn Aug 5, 2007, at 7:33 PM, Alex Riesen wrote:\n\n> Steffen Prohaska, Sun, Aug 05, 2007 13:37:34 +0200:\n>> How can I check what a 'git push' would do, without\n>> actually doing it?\n>>\n>> Is there something like 'git push --dry-run', similar\n>> to 'rsync --dry-run'?\n>\n> No. It is often safe to just do git-push, unless you have naive\n> developers doing pull every time some ref in your shared repo changes\n> *and* expecting the result to compile (typical for CVS way of work).\n> git-push will not overwrite anything, it always only forwards history.\n>\n> For the case you really want to know what the changes on remote repo\n> will be it is possible to fetch them into the local repo first and\n> compare with what you will push:\n>\n>     $ git fetch git://remote/path/REPO master:refs/remotes/REPO/master\n>     $ gitk local..REPO/master\n>\n> It gives you all possible information, which may be worth that bit of\n> work. Or, if you have all the remote configuration ready, it can be\n> just:\n>\n>     $ git fetch\n>     $ gitk local..REPO/master\n>\n\nThat applies only for a single branch. If I prepared a couple of\nbranches for pushing and somehow want to double check what I prepared,\n'git push --dry-run' would be quite handy. I know how to handle the\nsituation and could write a custom script that does all necessary\nchecks. But I haven't found an out-of-the-box solution for double\nchecking right before 'git push'\n\n\tSteffen\n"},{"id":"49945","messageId":"20070805220902.GB3159@steel.home","threadId":"9394","inReplyTo":"515E28B6-85AF-4379-870A-CFECF19B74DE@zib.de","subject":"Re: How to figure out what 'git push' would do?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-08-05T22:09:02Z","receivedAt":"2007-08-05T22:09:02Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Steffen Prohaska, Sun, Aug 05, 2007 21:56:37 +0200:\n> >\n> >    $ git fetch\n> >    $ gitk local..REPO/master\n> >\n> \n> That applies only for a single branch. If I prepared a couple of\n> branches for pushing and somehow want to double check what I prepared,\n> 'git push --dry-run' would be quite handy. I know how to handle the\n> situation and could write a custom script that does all necessary\n> checks. But I haven't found an out-of-the-box solution for double\n> checking right before 'git push'\n\nWell, you can do gitk local1..REPO/remote1 local2..REPO/remote2,\nof course, but yes, there is not out-of-the-box solution.\n\nAnd a straight-forward implementation of \"git-push --dry-run\" doesn't\nlook simple... The remote sides git-receive-pack still have to be\ncalled for any useful information, like the references updated and the\nSHA-1s they get. IOW, if you can update your system easily to support\n--dry-run, it still does not mean the server admin will do that just\nas readily. And AFAICS, receive-pack dies if given a parameter it\ndoes not know (it dies on every command line argument which begins\nwith \"-\", as it looks). Maybe we should change that first for a very\nslow start...\n\nIt is simplier to modify git-ls-remote of git-remote to just compare\nreference on local and remote side.\n"}]}