{"thread":{"id":"3821","subject":"Can't export whole repo as patches","startedAt":"2006-04-07T18:47:01Z","lastAt":"2006-04-09T08:22:48Z","messageCount":10,"participants":["Peter Baumann","Junio C Hamano","Jakub Narebski","Petr Baudis","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"18452","messageId":"20060407184701.GA6686@xp.machine.de","threadId":"3821","inReplyTo":null,"subject":"Can't export whole repo as patches","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-04-07T18:47:01Z","receivedAt":"2006-04-07T18:47:01Z","isPatch":false,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"I'd like to export the whole history of a project of mine via patches\nbut I can't get the inital commit.\n\nHow can I get the inital commit as a patch?\n\nThat's what I tried:\n\n  git --version\n  git version 1.2.4\t\t\t\t# debian sarge\n\n  mkdir /tmp/testrepo && cd /tmp/testrepo\n  git-init-db\n  echo a > a_file.txt\n  git-add a_file.txt\n  git-commit -a -m \"a_file added\"\n  echo b >> a_file.txt\n  git-commit -a -m \"a_file modifed\"\n  xp:/tmp/testrepo git-format-patch master~1\n  0001-a_file-modified.txt\n  cat 0001-a_file-modified.txt\n  From nobody Mon Sep 17 00:00:00 2001\n  From: Peter Baumann <peter.baumann@gmail.com>\n  Date: Fri Apr 7 12:20:54 2006 +0200\n  Subject: [PATCH] a_file modified\n\n  ---\n\n   a_file.txt |    1 +\n   1 files changed, 1 insertions(+), 0 deletions(-)\n\n  d8ceeed82a29004c066a98e0d390818e65fa9da7\n  diff --git a/a_file.txt b/a_file.txt\n  index 7898192..422c2b7 100644\n  --- a/a_file.txt\n  +++ b/a_file.txt\n  @@ -1 +1,2 @@\n   a\n  +b\n  --\n  1.2.4\n\n\nAs you can see, there is only a patch of the second commit. But it seems that\nthis behaviour is correct, because I asked for the diff between master^..master\n\nObviously, I wanted a way to get the diff of master~2..master.\n\nTrying harder:\n\n  git-format-patch master~2\n  Not a valid rev master~2 (master~2..HEAD)\n\nAny hint to the correct way is appreciated.\n\n</me thinking loudly>\nThe best would be if git would have an implicit tag or branch called \"init\"\n(name doesn't really matter) which is the root of an empty repository. In that case\none can do git-format-patch root..master and it would the right thing.\n\nGreetings,\n  Peter Baumann\n"},{"id":"18454","messageId":"7vr749i48s.fsf@assigned-by-dhcp.cox.net","threadId":"3821","inReplyTo":"20060407184701.GA6686@xp.machine.de","subject":"Re: Can't export whole repo as patches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-07T19:18:27Z","receivedAt":"2006-04-07T19:18:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Peter Baumann <peter.baumann@gmail.com> writes:\n\n> How can I get the inital commit as a patch?\n\nformat-patch is designed to get a patch to send to upstream, and\ndoes not handle the root commit.  In your two revisions\nrepository, you could do something like this:\n\n\t$ git diff-tree -p --root master~1\n\nOr more in general:\n\n\t$ git rev-list master |\n          git diff-tree --stdin --root --pretty=fuller -p\n\nBTW, I've been meaning to add --pretty=patch to give\nformat-patch compatible output to diff-tree, but haven't got\naround to actually do it.  Another thing I've been meaning to do\nis \"git log --diff\" which is more or less \"git whatchanged\".\n"},{"id":"18471","messageId":"20060408180244.GA4807@xp.machine.de","threadId":"3821","inReplyTo":"7vr749i48s.fsf@assigned-by-dhcp.cox.net","subject":"How to create independent branches","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-04-08T18:02:44Z","receivedAt":"2006-04-08T18:02:44Z","isPatch":false,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"On Fri, Apr 07, 2006 at 12:18:27PM -0700, Junio C Hamano wrote:\n> Peter Baumann <peter.baumann@gmail.com> writes:\n> \n> > How can I get the inital commit as a patch?\n> \n> format-patch is designed to get a patch to send to upstream, and\n> does not handle the root commit.  In your two revisions\n> repository, you could do something like this:\n> \n> \t$ git diff-tree -p --root master~1\n> \n> Or more in general:\n> \n> \t$ git rev-list master |\n>           git diff-tree --stdin --root --pretty=fuller -p\n> \n> BTW, I've been meaning to add --pretty=patch to give\n> format-patch compatible output to diff-tree, but haven't got\n> around to actually do it.  Another thing I've been meaning to do\n> is \"git log --diff\" which is more or less \"git whatchanged\".\n> \n\nOk. That did it.\n\nAnother question. I'd like to create a totaly independent branch (like\nthe \"todo\" branch in git). Is there a more user friendly way than doing\n\ngit-checkout -b todo\nrm .git/refs/heads/todo\nrm .git/index\nrm <all_files_in_your_workdir>\n\n... hack hack hack ...\ngit-commit -a\n\nI looked all over the docs, but can't find anything obvious.\n\n-Peter\n"},{"id":"18472","messageId":"e18vcv$rhf$1@sea.gmane.org","threadId":"3821","inReplyTo":"20060408180244.GA4807@xp.machine.de","subject":"Re: How to create independent branches","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-04-08T18:28:58Z","receivedAt":"2006-04-08T18:28:58Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Peter Baumann wrote:\n\n> Another question. I'd like to create a totaly independent branch (like\n> the \"todo\" branch in git). Is there a more user friendly way than doing\n> \n> git-checkout -b todo\n> rm .git/refs/heads/todo\n> rm .git/index\n> rm <all_files_in_your_workdir>\n> \n> ... hack hack hack ...\n> git-commit -a\n\nWouldn't it be better and more natural to go back to first commit, or even\nempty repository state at the beginning, and branch there? Or make separate\nrepository?\n\n-- \nJakub Narebski\nWarsaw, Poland\n"},{"id":"18479","messageId":"7vsloneqtb.fsf@assigned-by-dhcp.cox.net","threadId":"3821","inReplyTo":"20060408180244.GA4807@xp.machine.de","subject":"Re: How to create independent branches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-08T20:49:04Z","receivedAt":"2006-04-08T20:49:04Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Peter Baumann <peter.baumann@gmail.com> writes:\n\n> Another question. I'd like to create a totaly independent branch (like\n> the \"todo\" branch in git). Is there a more user friendly way than doing\n>\n> git-checkout -b todo\n> rm .git/refs/heads/todo\n> rm .git/index\n> rm <all_files_in_your_workdir>\n>\n> ... hack hack hack ...\n> git-commit -a\n>\n> I looked all over the docs, but can't find anything obvious.\n\nMy \"todo\" branch is not even part of my main git repository.  I\njust have two independent repositories (git and todo) locally,\nand push into the same public repository.\n\n        \n"},{"id":"18481","messageId":"20060408205747.GT27689@pasky.or.cz","threadId":"3821","inReplyTo":"7vsloneqtb.fsf@assigned-by-dhcp.cox.net","subject":"Re: How to create independent branches","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-04-08T20:57:47Z","receivedAt":"2006-04-08T20:57:47Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Apr 08, 2006 at 10:49:04PM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Peter Baumann <peter.baumann@gmail.com> writes:\n> \n> > Another question. I'd like to create a totaly independent branch (like\n> > the \"todo\" branch in git). Is there a more user friendly way than doing\n> >\n> > git-checkout -b todo\n> > rm .git/refs/heads/todo\n> > rm .git/index\n> > rm <all_files_in_your_workdir>\n> >\n> > ... hack hack hack ...\n> > git-commit -a\n> >\n> > I looked all over the docs, but can't find anything obvious.\n> \n> My \"todo\" branch is not even part of my main git repository.  I\n> just have two independent repositories (git and todo) locally,\n> and push into the same public repository.\n\nWouldn't it be better to separate it to two distinct public repositories\nas well? It's confusing people and encouraging a practice that really\nisn't very feasible and practical in Git.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nRight now I am having amnesia and deja-vu at the same time.  I think\nI have forgotten this before.\n"},{"id":"18482","messageId":"7virpjeqap.fsf@assigned-by-dhcp.cox.net","threadId":"3821","inReplyTo":"20060408205747.GT27689@pasky.or.cz","subject":"Re: How to create independent branches","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-08T21:00:14Z","receivedAt":"2006-04-08T21:00:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Wouldn't it be better to separate it to two distinct public repositories\n> as well? It's confusing people and encouraging a practice that really\n> isn't very feasible and practical in Git.\n\nThat's mainly historical.  I haven't bothered to check it\nrecently, but /pub/scm/git was not writable by me on kernel.org\nmachine, only /pub/scm/git/git.git/ was.\n"},{"id":"18484","messageId":"Pine.LNX.4.63.0604090006230.9176@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"3821","inReplyTo":"20060408205747.GT27689@pasky.or.cz","subject":"Re: How to create independent branches","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-04-08T22:09:21Z","receivedAt":"2006-04-08T22:09:21Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 8 Apr 2006, Petr Baudis wrote:\n\n> Dear diary, on Sat, Apr 08, 2006 at 10:49:04PM CEST, I got a letter\n> where Junio C Hamano <junkio@cox.net> said that...\n> > \n> > My \"todo\" branch is not even part of my main git repository.  I\n> > just have two independent repositories (git and todo) locally,\n> > and push into the same public repository.\n> \n> Wouldn't it be better to separate it to two distinct public repositories\n> as well? It's confusing people and encouraging a practice that really\n> isn't very feasible and practical in Git.\n\nHow so? I find it highly practical, and do it myself. For example, I track \na project which is not version-controlled at all. So I have a \"branch\" in \ngit where I keep the tools to fake that version-controlling. And git makes \nit easy to just fetch the changes of both the project and my tools.\n\nCiao,\nDscho\n"},{"id":"18491","messageId":"20060409081105.GA4798@xp.machine.de","threadId":"3821","inReplyTo":"e18vcv$rhf$1@sea.gmane.org","subject":"Re: How to create independent branches","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-04-09T08:11:05Z","receivedAt":"2006-04-09T08:11:05Z","isPatch":false,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"On Sat, Apr 08, 2006 at 08:28:58PM +0200, Jakub Narebski wrote:\n> Peter Baumann wrote:\n> \n> > Another question. I'd like to create a totaly independent branch (like\n> > the \"todo\" branch in git). Is there a more user friendly way than doing\n> > \n> > git-checkout -b todo\n> > rm .git/refs/heads/todo\n> > rm .git/index\n> > rm <all_files_in_your_workdir>\n> > \n> > ... hack hack hack ...\n> > git-commit -a\n> \n> Wouldn't it be better and more natural to go back to first commit? > \n\nIf I go back to the first commit, I'll get the following:\n\n\tfirst\n\t / \\\n\t/   \\\n   master    todo\n\nThat's not what I want, because in the near future I want to merge\nmaster and todo, but in my case, todo consists of only of one file (lets\ncall it file_a), and the master branch has severeal files (file_{a..z}).\nIf I go back to first, I have to delete all files file_{b..z}.\nFurther file_a from todo and file_a from master are not equal, the share\njust the same name. But in the near future, they will be merged\ntogether, so they are equal.\n\nIf I go with the above branching, I'll _think_ (I may be wrong, please\ncorrect me if I am) I get a merge conflict or worse, all my other files\nfile_a{b..z} are merged as \"deleted\", wich is wrong.\n\n> Or even empty repository state at the beginning, and branch there?\n\nThis isn't possible because the repository already exists and I don't\nknow how to go back to the empty repository state. Even \n\n\tgit-init-db\n\tgit branch todo master\n\ndidn't work.\n\n> Or make separate repository?\n\nOk. You got it. In fact, the todo branch alread exists as a seperate\nrepository and I'd like to integrate this in my master repository for\neasier handling (diff etc.)\n\nTo import todo as a subproject doesn't seem right, because it's not\nsomething really independent in the view of the master repo and I'am\ngoing to merge todo _into_ master in the near future.\n\nAny further suggestions?\n\n-Peter\n"},{"id":"18492","messageId":"20060409082248.GB4798@xp.machine.de","threadId":"3821","inReplyTo":"20060409081105.GA4798@xp.machine.de","subject":"Re: How to create independent branches","fromName":"Peter Baumann","fromEmail":"peter.baumann@gmail.com","sentAt":"2006-04-09T08:22:48Z","receivedAt":"2006-04-09T08:22:48Z","isPatch":false,"sender":{"key":"peter.baumann@gmail.com","avatar":null},"body":"On Sun, Apr 09, 2006 at 10:11:05AM +0200, Peter Baumann wrote:\n> On Sat, Apr 08, 2006 at 08:28:58PM +0200, Jakub Narebski wrote:\n> > Peter Baumann wrote:\n> > \n> > > Another question. I'd like to create a totaly independent branch (like\n> > > the \"todo\" branch in git). Is there a more user friendly way than doing\n> > > \n> > > git-checkout -b todo\n> > > rm .git/refs/heads/todo\n> > > rm .git/index\n> > > rm <all_files_in_your_workdir>\n> > > \n> > > ... hack hack hack ...\n> > > git-commit -a\n> > \n> > Wouldn't it be better and more natural to go back to first commit? > \n> \n> If I go back to the first commit, I'll get the following:\n> \n> \tfirst\n> \t / \\\n> \t/   \\\n>    master    todo\n> \n> That's not what I want, because in the near future I want to merge\n> master and todo, but in my case, todo consists of only of one file (lets\n> call it file_a), and the master branch has severeal files (file_{a..z}).\n> If I go back to first, I have to delete all files file_{b..z}.\n> Further file_a from todo and file_a from master are not equal, the share\n> just the same name. But in the near future, they will be merged\n> together, so they are equal.\n> \n> If I go with the above branching, I'll _think_ (I may be wrong, please\n> correct me if I am) I get a merge conflict or worse, all my other files\n> file_a{b..z} are merged as \"deleted\", wich is wrong.\n> \n> > Or even empty repository state at the beginning, and branch there?\n> \n> This isn't possible because the repository already exists and I don't\n> know how to go back to the empty repository state. Even \n> \n> \tgit-init-db\n> \tgit branch todo master\n> \n> didn't work.\n> \n> > Or make separate repository?\n> \n> Ok. You got it. In fact, the todo branch alread exists as a seperate\n> repository and I'd like to integrate this in my master repository for\n> easier handling (diff etc.)\n> \n> To import todo as a subproject doesn't seem right, because it's not\n> something really independent in the view of the master repo and I'am\n> going to merge todo _into_ master in the near future.\n> \n> Any further suggestions?\n> \n\nJust in case nobody noticed, that's why I asked for exporting the whole repo\nwith git-format-patch in the first place, because I'd like to import the \npatches with git-am in the totally independent branch.\n\nPeter\n"}]}