{"thread":{"id":"16891","subject":"for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","startedAt":"2008-12-27T21:54:16Z","lastAt":"2008-12-31T01:43:42Z","messageCount":21,"participants":["Zorba","Jeff Whiteside","Sitaram Chamarty","Daniel Barkalow","Boyd Stephen Smith Jr."],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"98812","messageId":"gj68a0$u56$3@ger.gmane.org","threadId":"16891","inReplyTo":null,"subject":"for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-27T21:54:16Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Here is a little exercise / tutorial / warm-up for someone starting out with \nGit. If you're anyting like me you may find the tutorials etc. on git.or.cz \na bit daunting. I recommend you try this after reading the user manual but \nbefore tearing your hair out trying to follow all the examples in the user \nmanual. After you've followed this simple workflow, then go back to the more \nadvanced stuff  in the tutorials and user manuals (like cloning repositories \nand creating and merging branches).\n\nI created this exercise to try and model our workflow and what we wanted to \nuse git for = tracking a project with multiple files where the filebase \nmight change frequently from one version to the next.\n\nhttp://siliconmouth.wordpress.com/category/nerdy/\n\nlook for December 27, 2008 or \"git warmup\" \n"},{"id":"98827","messageId":"gj6kqq$nvh$4@ger.gmane.org","threadId":"16891","inReplyTo":"gj68a0$u56$3@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-28T00:30:01Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"tidied up the formatting, added a few more comments where needed, fixed \nerrors/lack of clarity\n\n\"Zorba\" <cr@altmore.co.uk> wrote in message \nnews:gj68a0$u56$3@ger.gmane.org...\n> Here is a little exercise / tutorial / warm-up for someone starting out \n> with Git. If you're anyting like me you may find the tutorials etc. on \n> git.or.cz a bit daunting. I recommend you try this after reading the user \n> manual but before tearing your hair out trying to follow all the examples \n> in the user manual. After you've followed this simple workflow, then go \n> back to the more advanced stuff  in the tutorials and user manuals (like \n> cloning repositories and creating and merging branches).\n>\n> I created this exercise to try and model our workflow and what we wanted \n> to use git for = tracking a project with multiple files where the filebase \n> might change frequently from one version to the next.\n>\n> http://siliconmouth.wordpress.com/category/nerdy/\n>\n> look for December 27, 2008 or \"git warmup\"\n>\n> \n"},{"id":"98926","messageId":"3ab397d0812291505v77824e6fvdecebc80f38a5f89@mail.gmail.com","threadId":"16891","inReplyTo":"gj6kqq$nvh$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Jeff Whiteside","fromEmail":"jeff.m.whiteside@gmail.com","sentAt":"2008-12-29T23:05:57Z","receivedAt":"2008-12-29T23:05:57Z","isPatch":false,"sender":{"key":"jeff.m.whiteside@gmail.com","avatar":null},"body":"hi zorb,\n\nyou have done a great justice here to inadvertently explaining the\nlearning curve of git, through a few mistakes, especially for ppl\nbehind in their scm use.  i enjoyed reading your blog posts though, as\nthey remind me of myself, not long ago.\n\nyou have a couple of mistakes i think you should correct.\n\n-\"Imagine a project with 4 versions, made up of various configurations\nof the three files.\"\nthis line implies that you have branches (the word configurations).\nyou should be focusing, at first, on a project that has a set number\nof files, and the content merely changes.  ideally, you don't often\nadd and rm files across versions.  also, the project doesn't really\nhave 4 versions, like windows has 4 different versions of vista, the\nproject has 3 old versions and 1 new version.\n\n\"Setup a git index in the project directory\"\n-this implies you're talking about the index.  you're not.  you're\ntalking about the repository.  either make it clear that the index is\nan intermediary staging area, or ignore its existence and change all\ngit-add && git-commit references to git-commit -a references.  this\nwill ease the user of older scms into git.\n\n-\"Rollback to each of the versions, starting with version A\"\nthis is bad.  you're saying rollback.  to others that have used scms,\nthis will mean, \"retrieve an older copy\", but in git, this is DELETING\nall the versions after the version that you \"rollback\" to.  your blog\npost shouldn't discuss the git-reset --hard command at all, since\nyou're rewriting history, which is dangerous.  afaik, most scms don't\nallow you to rewrite history.  to \"rollback\" to an older version you\nshould use checkout the git-checkout command.  maybe the git reset\n-–hard HEAD is okay to include... but it won't be immediately obvious\nto new users why it does what it does... this nomenclature was likely\nnot the best choice whenever it was made.\n\n\ngl with your gitting.\n\nwhiteside\n\n\n\n\nu're talking sdf\n\n\n\n\nOn Sat, Dec 27, 2008 at 5:29 PM, Zorba <cr@altmore.co.uk> wrote:\n>\n> tidied up the formatting, added a few more comments where needed, fixed\n> errors/lack of clarity\n>\n> \"Zorba\" <cr@altmore.co.uk> wrote in message\n> news:gj68a0$u56$3@ger.gmane.org...\n> > Here is a little exercise / tutorial / warm-up for someone starting out\n> > with Git. If you're anyting like me you may find the tutorials etc. on\n> > git.or.cz a bit daunting. I recommend you try this after reading the user\n> > manual but before tearing your hair out trying to follow all the examples\n> > in the user manual. After you've followed this simple workflow, then go\n> > back to the more advanced stuff  in the tutorials and user manuals (like\n> > cloning repositories and creating and merging branches).\n> >\n> > I created this exercise to try and model our workflow and what we wanted\n> > to use git for = tracking a project with multiple files where the filebase\n> > might change frequently from one version to the next.\n> >\n> > http://siliconmouth.wordpress.com/category/nerdy/\n> >\n> > look for December 27, 2008 or \"git warmup\"\n> >\n> >\n>\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"98942","messageId":"gjc7qa$jdj$4@ger.gmane.org","threadId":"16891","inReplyTo":"3ab397d0812291505v77824e6fvdecebc80f38a5f89@mail.gmail.com","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T04:17:30Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Hi Jeff,\n\nThanks for your contrib. I'll pick these up for sure, but right now I'm \ndespo to make some progress getting this confounded real-life project \nversioned.\n\nBut where I'm stuck now touches on your post.\n\nI've just made a commit I want to retract.\n\nI have been using $ git reset --hard <version> as an escalator to ascend / \ndescend the versions up and down\nSurely it doesn't alter the history, as I can commit versionA, versionB, \nversionC, and then reset to A, then reset to C, then reset to B.\n\nso when I reset to A, I've still got the ability to get to B or C again\n\nNow I appreciate that if I commit a new change from versionA (lets call it \nB1), then HEAD is now at B1, and B, C etc are lost, correct ?\n\nIts pertinent to where I am right now, as I've goofed a commit, and want to \nreset, and commit again but I'm worried about leaveing garbage lying around \n(the commits for version B and C in the example above).\n\nNB if you read my latest posts you will see why I chose the example I did \nfor my \"warm-up\" as it closely models what I'm trying to do for real.\n\n\nBTW: sdf=Syntax Definition Formalism?\n\n\"Jeff Whiteside\" <jeff.m.whiteside@gmail.com> wrote in message \nnews:3ab397d0812291505v77824e6fvdecebc80f38a5f89@mail.gmail.com...\n\n-\"Rollback to each of the versions, starting with version A\"\nthis is bad.  you're saying rollback.  to others that have used scms,\nthis will mean, \"retrieve an older copy\", but in git, this is DELETING\nall the versions after the version that you \"rollback\" to.  your blog\npost shouldn't discuss the git-reset --hard command at all, since\nyou're rewriting history, which is dangerous.  afaik, most scms don't\nallow you to rewrite history.  to \"rollback\" to an older version you\nshould use checkout the git-checkout command.  maybe the git reset\n-hard HEAD is okay to include... but it won't be immediately obvious\nto new users why it does what it does... this nomenclature was likely\nnot the best choice whenever it was made.\n\n\ngl with your gitting.\n\nwhiteside\n\n\n\n\nu're talking sdf\n\n\n\n\nOn Sat, Dec 27, 2008 at 5:29 PM, Zorba <cr@altmore.co.uk> wrote:\n>\n> tidied up the formatting, added a few more comments where needed, fixed\n> errors/lack of clarity\n>\n> \"Zorba\" <cr@altmore.co.uk> wrote in message\n> news:gj68a0$u56$3@ger.gmane.org...\n> > Here is a little exercise / tutorial / warm-up for someone starting out\n> > with Git. If you're anyting like me you may find the tutorials etc. on\n> > git.or.cz a bit daunting. I recommend you try this after reading the \n> > user\n> > manual but before tearing your hair out trying to follow all the \n> > examples\n> > in the user manual. After you've followed this simple workflow, then go\n> > back to the more advanced stuff  in the tutorials and user manuals (like\n> > cloning repositories and creating and merging branches).\n> >\n> > I created this exercise to try and model our workflow and what we wanted\n> > to use git for = tracking a project with multiple files where the \n> > filebase\n> > might change frequently from one version to the next.\n> >\n> > http://siliconmouth.wordpress.com/category/nerdy/\n> >\n> > look for December 27, 2008 or \"git warmup\"\n> >\n> >\n>\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html \n"},{"id":"98948","messageId":"3ab397d0812292133r7955e892g6c19ca46629e7103@mail.gmail.com","threadId":"16891","inReplyTo":"gjc7qa$jdj$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Jeff Whiteside","fromEmail":"jeff.m.whiteside@gmail.com","sentAt":"2008-12-30T05:33:06Z","receivedAt":"2008-12-30T05:33:06Z","isPatch":false,"sender":{"key":"jeff.m.whiteside@gmail.com","avatar":null},"body":"> Thanks for your contrib. I'll pick these up for sure, but right now I'm\n> despo to make some progress getting this confounded real-life project\n> versioned.\n\nnp, i do understand totally.\n\n> I've just made a commit I want to retract.\n\nthis is the purpose of git reset --soft/mixed/hard\n\n> I have been using $ git reset --hard <version> as an escalator to ascend /\n> descend the versions up and down\n\nyou should probably be using git checkout for this\n\n> Surely it doesn't alter the history, as I can commit versionA, versionB,\n> versionC, and then reset to A, then reset to C, then reset to B.\n\ni does alter the history.  i think this works because git isnt'\ndeleting the actual blob objects in the git dir until you use the git\nprune, or gc or whatever (i never use it anyway).  but, you are\naltering history, and just happen to be recovering.\n\n> so when I reset to A, I've still got the ability to get to B or C again\n\nwith an uneasy conscience ;)\n\n> Now I appreciate that if I commit a new change from versionA (lets call it\n> B1), then HEAD is now at B1, and B, C etc are lost, correct ?\n\nyes! but this is not true if you had done a git checkout (there are\nmeasures to recover B and C, provided you haven't done a prune.  i\nthink git reflog has some answers here, but i'm still a newbie).\n\n> Its pertinent to where I am right now, as I've goofed a commit, and want to\n> reset, and commit again but I'm worried about leaveing garbage lying around\n> (the commits for version B and C in the example above).\n\nyou've goofed what commit (a1?, c?, d3?)?  where are you now and what\ndo you want to do now? reset to what version?  if you're just worried\nabout space used by B and C, i think git prune will purge these (look\nat man page, don't guess at the syntax).\n\ni half suspect that you want to git branch at some point, but if\nyo'ure just recretaing the other code bases' history form other files,\nyou shouldn't be able to break too much by git reset --hard, or git\nprune.\n\n> BTW: sdf=Syntax Definition Formalism?\n\nhahahaha, no, i was just typing/copypasting garbage, because my gmail\nwoudln't' get out of bold mode and forgot to delete it at the end.\nhaha.\n\nOn Mon, Dec 29, 2008 at 8:24 PM, Zorba <cr@altmore.co.uk> wrote:\n> Hi Jeff,\n>\n> Thanks for your contrib. I'll pick these up for sure, but right now I'm\n> despo to make some progress getting this confounded real-life project\n> versioned.\n>\n> But where I'm stuck now touches on your post.\n>\n> I've just made a commit I want to retract.\n>\n> I have been using $ git reset --hard <version> as an escalator to ascend /\n> descend the versions up and down\n> Surely it doesn't alter the history, as I can commit versionA, versionB,\n> versionC, and then reset to A, then reset to C, then reset to B.\n>\n> so when I reset to A, I've still got the ability to get to B or C again\n>\n> Now I appreciate that if I commit a new change from versionA (lets call it\n> B1), then HEAD is now at B1, and B, C etc are lost, correct ?\n>\n> Its pertinent to where I am right now, as I've goofed a commit, and want to\n> reset, and commit again but I'm worried about leaveing garbage lying around\n> (the commits for version B and C in the example above).\n>\n> NB if you read my latest posts you will see why I chose the example I did\n> for my \"warm-up\" as it closely models what I'm trying to do for real.\n>\n>\n> BTW: sdf=Syntax Definition Formalism?\n>\n> \"Jeff Whiteside\" <jeff.m.whiteside@gmail.com> wrote in message\n> news:3ab397d0812291505v77824e6fvdecebc80f38a5f89@mail.gmail.com...\n>\n> -\"Rollback to each of the versions, starting with version A\"\n> this is bad.  you're saying rollback.  to others that have used scms,\n> this will mean, \"retrieve an older copy\", but in git, this is DELETING\n> all the versions after the version that you \"rollback\" to.  your blog\n> post shouldn't discuss the git-reset --hard command at all, since\n> you're rewriting history, which is dangerous.  afaik, most scms don't\n> allow you to rewrite history.  to \"rollback\" to an older version you\n> should use checkout the git-checkout command.  maybe the git reset\n> -–hard HEAD is okay to include... but it won't be immediately obvious\n> to new users why it does what it does... this nomenclature was likely\n> not the best choice whenever it was made.\n>\n>\n> gl with your gitting.\n>\n> whiteside\n>\n>\n>\n>\n> u're talking sdf\n>\n>\n>\n>\n> On Sat, Dec 27, 2008 at 5:29 PM, Zorba <cr@altmore.co.uk> wrote:\n>>\n>> tidied up the formatting, added a few more comments where needed, fixed\n>> errors/lack of clarity\n>>\n>> \"Zorba\" <cr@altmore.co.uk> wrote in message\n>> news:gj68a0$u56$3@ger.gmane.org...\n>> > Here is a little exercise / tutorial / warm-up for someone starting out\n>> > with Git. If you're anyting like me you may find the tutorials etc. on\n>> > git.or.cz a bit daunting. I recommend you try this after reading the\n>> > user\n>> > manual but before tearing your hair out trying to follow all the\n>> > examples\n>> > in the user manual. After you've followed this simple workflow, then go\n>> > back to the more advanced stuff  in the tutorials and user manuals (like\n>> > cloning repositories and creating and merging branches).\n>> >\n>> > I created this exercise to try and model our workflow and what we wanted\n>> > to use git for = tracking a project with multiple files where the\n>> > filebase\n>> > might change frequently from one version to the next.\n>> >\n>> > http://siliconmouth.wordpress.com/category/nerdy/\n>> >\n>> > look for December 27, 2008 or \"git warmup\"\n>> >\n>> >\n>>\n>>\n>>\n>> --\n>> To unsubscribe from this list: send the line \"unsubscribe git\" in\n>> the body of a message to majordomo@vger.kernel.org\n>> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"98949","messageId":"slrngljcne.n7q.sitaramc@sitaramc.homelinux.net","threadId":"16891","inReplyTo":"gjc7qa$jdj$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2008-12-30T05:34:38Z","receivedAt":"2008-12-30T05:34:38Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"Hi Conor,\n\nOn 2008-12-30, Zorba <cr@altmore.co.uk> wrote:\n> so when I reset to A, I've still got the ability to get to B or C again\n\nif this is true...  (call this case 1)\n\n> Now I appreciate that if I commit a new change from versionA (lets call it \n> B1), then HEAD is now at B1, and B, C etc are lost, correct ?\n\n...then this (call this case 2) is not true.\n\nIn case 1, *how* do you get back to B and C?  However you do\nit, the same action will get you to B and C *after* you\ncreated B1 as well.\n\nIt might help to think of these things loosely using a\nmalloc/linked-list analogy.  Imagine a singly-linked list,\nand a variable in your program called \"head\" pointing to the\ntop element.  Each element contains a back-pointer to its\nparent.  You can start from head and walk the list backward,\nbut you can't walk forward -- there are no forward pointers.\n\nA \"git commit\" is analogous to:\n    newblkptr = malloc(...);\n    ... store whatever you want in the new block ...\n    newblkptr.backptr = head;\n    head = newblkptr;\n\ni.e., a classic linked list add.\n\nA \"git reset --hard HEAD^\" essentially pops the topmost\nelement off the list:\n    head = head.backptr\n\nA \"git checkout -f HEAD^\" is like walking a linked list\nbackward in a loop, and stopping at some intermediate block\nto do something -- other the temporary loop-variable,\nnothing else (no global variable perhaps) points to this\nblock, so this is like a detached head.\n\nOf course, nothing prevents you from permanently saving this\ntemporary loop variable because you suddenly realise *this*\nlink in the chain is very important for the rest of your\nprogram:\n    some_global_var = temp_blk_ptr;\n\nThis is like \"git checkout -b newbranch\" does.\n\n> Its pertinent to where I am right now, as I've goofed a commit, and want to \n> reset, and commit again but I'm worried about leaveing garbage lying around \n> (the commits for version B and C in the example above).\n\n(1) never worry about leaving garbage around; there are many\noperations that do that; it's part of the design.  Don't\nsweat it.\n\n(2) when in doubt, try \"gitk --all\".  That's a good GUI.\nI'm normally a CLI freak, but when something needs to be\nunderstood/learnt, a well-designed GUI really helps.\n\nRun \"gitk --all\" on the side and hit F5 on it after each\noperation on the command line -- helped me when I was trying\nto figure out what's happening.\n\nPS: although it doesn't mention detached heads,\nhttp://eagain.net/articles/git-for-computer-scientists/\nhelped me a lot...\n"},{"id":"98965","messageId":"gjd3lp$f1d$4@ger.gmane.org","threadId":"16891","inReplyTo":"3ab397d0812292133r7955e892g6c19ca46629e7103@mail.gmail.com","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T12:20:18Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"> I have been using $ git reset --hard <version> as an escalator to ascend /\n> descend the versions up and down\n\nyou should probably be using git checkout for this\n\n> Surely it doesn't alter the history, as I can commit versionA, versionB,\n> versionC, and then reset to A, then reset to C, then reset to B.\n\ni does alter the history.  i think this works because git isnt'\ndeleting the actual blob objects in the git dir until you use the git\nprune, or gc or whatever (i never use it anyway).  but, you are\naltering history, and just happen to be recovering.\n\n** Ok!, so after commit B1, versionA doesn't store a link to versionB \nnatively on and of its own accord. In other words BA and C are now written \nOUT of the history, as you say. I'm relying on some cached meta data that \nallows me to go back up the version tree again (ie downstream) and write B \nand/or C back into the history, which I should not rely on having access to \nall the time. Now I'm understanding more about differences between git-reset \nand git-checkout\n\n> so when I reset to A, I've still got the ability to get to B or C again\n\nwith an uneasy conscience ;)\n\n** yes, if the metadata cache failed or got wiped, I'd be screwed for \ngetting back to later commits\nI see !\nI'm relying on something that isn't part of the intrinsic design... hmmm\n\n> Now I appreciate that if I commit a new change from versionA (lets call it\n> B1), then HEAD is now at B1, and B, C etc are lost, correct ?\n\nyes! but this is not true if you had done a git checkout (there are\nmeasures to recover B and C, provided you haven't done a prune.  i\nthink git reflog has some answers here, but i'm still a newbie).\n\n> Its pertinent to where I am right now, as I've goofed a commit, and want \n> to\n> reset, and commit again but I'm worried about leaveing garbage lying \n> around\n> (the commits for version B and C in the example above).\n\nyou've goofed what commit (a1?, c?, d3?)?  where are you now and what\ndo you want to do now? reset to what version?  if you're just worried\nabout space used by B and C, i think git prune will purge these (look\nat man page, don't guess at the syntax).\n\n** I goofed B, so I reset to A, and redid the edits correctly this time \n(using your tip from other post $ git add -A = thanks again!), so now am on \nB1.\nHaving read your notes, I am now comfortable about letting B and C hang \naround, as I realise now they are out of the official picture. Sitaram's \ncomparison of a linked list helps since there is no branch/merge: B1 can \nonly have one parent, which is A, so A can only have one child which is B1 \n(and B and C are relying on the cached stuff to survive, so let 'em freeze \n!)\n\ni half suspect that you want to git branch at some point, but if\nyo'ure just recretaing the other code bases' history form other files,\nyou shouldn't be able to break too much by git reset --hard, or git\nprune.\n\n** yes I might well want to at some point, but don't want to run before \nwalking. I'm the only one on this project currently, and still archiving old \nversions into git. When I get the latest one in, I may branch so I can work \naway without affecting a stable master branch.\n"},{"id":"98978","messageId":"gjdh0r$n3c$4@ger.gmane.org","threadId":"16891","inReplyTo":"3ab397d0812291505v77824e6fvdecebc80f38a5f89@mail.gmail.com","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T15:36:49Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"\n\"Jeff Whiteside\" <jeff.m.whiteside@gmail.com> wrote in message \nnews:3ab397d0812291505v77824e6fvdecebc80f38a5f89@mail.gmail.com...\nhi zorb,\n\nyou have done a great justice here to inadvertently explaining the\nlearning curve of git, through a few mistakes, especially for ppl\nbehind in their scm use.  i enjoyed reading your blog posts though, as\nthey remind me of myself, not long ago.\n\nyou have a couple of mistakes i think you should correct.\n\n-\"Imagine a project with 4 versions, made up of various configurations\nof the three files.\"\nthis line implies that you have branches (the word configurations).\nyou should be focusing, at first, on a project that has a set number\nof files, and the content merely changes.  ideally, you don't often\nadd and rm files across versions.  also, the project doesn't really\nhave 4 versions, like windows has 4 different versions of vista, the\nproject has 3 old versions and 1 new version.\n\n** ok, I've changed \"configurations\" as its overloaded in the context of \nolder SCMs.\nPoint taken about changing content not containers. However changing content \nis easier, and therefore less need for a tutorial\nAlso this write-up is basically a \"note to self\", that I've cleaned up in \ncase someone else can find it useful, and the problem I was solving was a \nproblem that involved containers changing.\nI've explained the context for going the way of containers now in the \nwrite-up.\nI've covered off your concern for ppl thinking we have 4x current versions \n(ie. branches) with \"4 progressively more recent versions\"\n\n\"Setup a git index in the project directory\"\n-this implies you're talking about the index.  you're not.  you're\ntalking about the repository.  either make it clear that the index is\nan intermediary staging area, or ignore its existence and change all\ngit-add && git-commit references to git-commit -a references.  this\nwill ease the user of older scms into git.\n\n** Don't forget they'll have read the tutorial and/or user-guide, and the \nconcepts of an index and staging are fairly easy to pick up.\nI'll keep it in, and make sure I refer to it as you suggest.\n\n-\"Rollback to each of the versions, starting with version A\"\nthis is bad.  you're saying rollback.  to others that have used scms,\nthis will mean, \"retrieve an older copy\", but in git, this is DELETING\nall the versions after the version that you \"rollback\" to.  your blog\npost shouldn't discuss the git-reset --hard command at all, since\nyou're rewriting history, which is dangerous.  afaik, most scms don't\nallow you to rewrite history.  to \"rollback\" to an older version you\nshould use checkout the git-checkout command.  maybe the git reset\n-hard HEAD is okay to include... but it won't be immediately obvious\nto new users why it does what it does... this nomenclature was likely\nnot the best choice whenever it was made.\n\n** have now promoted git-checkout as the way to review older versions\nI've left git-reset in there, for my own notes as much as anything, but not \nsuggesting it be used as some sort of cursor to move the HEAD up and down \nthe branch\n\nNB getting some funny results with git-checkout near the head of the branch\n- will investigatge and report\n\n\n\n\n\nu're talking sdf\n\n\n\n\nOn Sat, Dec 27, 2008 at 5:29 PM, Zorba <cr@altmore.co.uk> wrote:\n>\n> tidied up the formatting, added a few more comments where needed, fixed\n> errors/lack of clarity\n>\n> \"Zorba\" <cr@altmore.co.uk> wrote in message\n> news:gj68a0$u56$3@ger.gmane.org...\n> > Here is a little exercise / tutorial / warm-up for someone starting out\n> > with Git. If you're anyting like me you may find the tutorials etc. on\n> > git.or.cz a bit daunting. I recommend you try this after reading the \n> > user\n> > manual but before tearing your hair out trying to follow all the \n> > examples\n> > in the user manual. After you've followed this simple workflow, then go\n> > back to the more advanced stuff  in the tutorials and user manuals (like\n> > cloning repositories and creating and merging branches).\n> >\n> > I created this exercise to try and model our workflow and what we wanted\n> > to use git for = tracking a project with multiple files where the \n> > filebase\n> > might change frequently from one version to the next.\n> >\n> > http://siliconmouth.wordpress.com/category/nerdy/\n> >\n> > look for December 27, 2008 or \"git warmup\"\n> >\n> >\n>\n>\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html \n"},{"id":"98982","messageId":"gjdlcl$5no$4@ger.gmane.org","threadId":"16891","inReplyTo":"gjdh0r$n3c$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T17:04:58Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Ok, when I do\n\n$ rm *.*\n$ git checkout versionA .\n\nI'm getting ABC.txt, AC.txt, BC.txt\n\nwhich is wrong as only the first two files went into version A\n\nParadoxically\n\n$ rm *.*\n$ git reset --hard versionA\n\nproduces the desired result!\n\nI picked up a few cases like this with git-checkout today. Usually a file or \ntwo gets copied into the working tree that shouldn't have been (and I'm \nclearing the working tree before each checkout, so its not \"leftovers\", its \ndefo git-checkout doing it)\n\nIts coming back to me now - when I was writing my \"warm-up\" I tried both \ngit-checkout and git-reset, to do my \"rollbacks\" and git-checkout produced a \nfew inconsistent results like above, so I decided to stick with git-reset \n(this was before I knew the dangers of git-reset of course!) for \"safety\".\n\nCould it be that all the \"vandalism\" I've perpetrated to the history by \nresetting in a FORWARD direction could have corrupted the history somehow ?\n\nEven so, you'd expect something vanilla like $ git checkout  not to be \naffected.\n\nI'm gonna try the checkouts without doing any resetting beforehand (i.e. no \nmessing with the history) to see if I can reproduce this.\n\n\n\n\"Zorba\" <cr@altmore.co.uk> wrote in message \nnews:gjdh0r$n3c$4@ger.gmane.org...\n\n** have now promoted git-checkout as the way to review older versions\nI've left git-reset in there, for my own notes as much as anything, but not\nsuggesting it be used as some sort of cursor to move the HEAD up and down\nthe branch\n\nNB getting some funny results with git-checkout near the head of the branch\n- will investigatge and report\n"},{"id":"98983","messageId":"gjdmm6$9oj$4@ger.gmane.org","threadId":"16891","inReplyTo":"gjdlcl$5no$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T17:04:58Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"So I deleted the repo and the working tree, restarted the git bash (i.e. \nwiped the slate clean) and started my little warm up workflow again, getting \nas far as just created and tagged versionD.\n\nSo lets do some checking out\n\n$ rm *.*\n$ git checkout versionA .\n\ngives ABC.txt, AC.txt = correct\nhowever...\n\n$ rm *.*\n$ git checkout versionB .\n\ngives ABC.txt, AC.txt, BC.txt\nwhich is wrong\n\nrunning gitk confirms that AC.txt should not be in versionB\n\n!!!! \n"},{"id":"98984","messageId":"3ab397d0812301035w3dcd872fkae9509629a0ed7de@mail.gmail.com","threadId":"16891","inReplyTo":"gjdmm6$9oj$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Jeff Whiteside","fromEmail":"jeff.m.whiteside@gmail.com","sentAt":"2008-12-30T18:35:32Z","receivedAt":"2008-12-30T18:35:32Z","isPatch":false,"sender":{"key":"jeff.m.whiteside@gmail.com","avatar":null},"body":"> commit -a detects that files have been deleted, and takes them out of the index !\n> could also have used $ git rm <specific files> and then $ git commit ..\n\nhey! i like your changes! the post is pretty polished now.  the only\nthing else i would change (srysry), is the above.  \"-a detects that\nfiles have been deleted\"  -> heh, not true.  you don't need -a here;\nit does something else.\n\nokay i just recreated your repo and did the same thing.  with your\nsyntax \"git checkout versionA .\" i got the same result, and i'm not\nsure why, but i think it was because of the detached head.\n\ngood news, use \"git checkout versionA\", not \"git checkout versionA .\"\n(so, use it wihtout the dot), and you should be back in working order.\n\nthe other (good?)  news is that you probably _do_ want to be using git\nreset --hard in your case, because you're trying to build up a history\nfrom some project, so you do want to erase some faulty commits after\nyou bodge something or miss some files.\n\nthe bad news is that my opinion is that you should probably move on\nwith your life, because my own past tells me that you'll never\nactually use those old project versions, hahah :p\n"},{"id":"98985","messageId":"alpine.LNX.1.00.0812301348440.19665@iabervon.org","threadId":"16891","inReplyTo":"gj68a0$u56$3@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-12-30T19:42:40Z","receivedAt":"2008-12-30T19:42:40Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Sat, 27 Dec 2008, Zorba wrote:\n\n> Here is a little exercise / tutorial / warm-up for someone starting out with \n> Git. If you're anyting like me you may find the tutorials etc. on git.or.cz \n> a bit daunting. I recommend you try this after reading the user manual but \n> before tearing your hair out trying to follow all the examples in the user \n> manual. After you've followed this simple workflow, then go back to the more \n> advanced stuff  in the tutorials and user manuals (like cloning repositories \n> and creating and merging branches).\n>\n> I created this exercise to try and model our workflow and what we wanted to \n> use git for = tracking a project with multiple files where the filebase \n> might change frequently from one version to the next.\n\nOne thing I find unrealistic about this example is that you've got BC.txt \nand C.txt when you're creating version A, and you've even copied them to \nthe working directory. In real life, you'd almost certainly not create the \nfiles until you're preparing the version that includes them, at least if \nyour history is version A, version B, version C. (Now, it's possible that \nyour history is \"create a bunch of files\", \"create version A without \nBC.txt and C.txt\"; in parallel to version A, create version B without \nAC.txt and C.txt; but that's a different process entirely.)\n\nI think the exercise would come out much more easily if you only created \nABC.txt and AC.txt at the beginning, made version A, added BC.txt and \nremoved AC.txt, made version B, created C.txt and recovered AC.txt, and \nmade version C; this is, I believe, what would actually happen.\n\nIf you're having trouble with \"git commit\" putting you in a lousy editor, \nsomebody probably needs to do better packaging. \"git commit\" (without the \n-m) should open up the best editor available on your computer, but it \ndoesn't seem to have a good idea about your preferences for editors. Of \ncourse, part of the problem is people who don't like that editor rarely \nuse the command line on Windows. Do you have a good editor for Windows? \nHow have you specified it, if so?\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"98995","messageId":"gje3ok$gnc$4@ger.gmane.org","threadId":"16891","inReplyTo":"gjdmm6$9oj$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T21:04:13Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"** REPRODUCING Possible bug\nrebooted PC, opened a new git bash, and started from scratch - see console \noutput below\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n\nWelcome to Git (version 1.6.0.2-preview20080923)\n\n\nRun 'git help git' to display the help index.\nRun 'git help <command>' to display help for specific commands.\n\nconorr@KINKLADZE /w/GITPLATFORM\n$ mkdir swproj\n\nconorr@KINKLADZE /w/GITPLATFORM\n$ cd swproj\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ cat > ABC.txt\nABC\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ cat > BC.txt\nBC\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ cat > AC.txt\nAC\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ cat > C.txt\nC\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ ls\nABC.txt  AC.txt  BC.txt  C.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git init\nInitialized empty Git repository in w:/GITPLATFORM/swproj/.git/\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git add *a*.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git commit -m \"version A\"\nCreated initial commit 2b88490: version A\n 2 files changed, 2 insertions(+), 0 deletions(-)\n create mode 100644 ABC.txt\n create mode 100644 AC.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git tag versionA 2b88\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git rm AC.txt\nrm 'AC.txt'\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git add BC.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git status\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       deleted:    AC.txt\n#       new file:   BC.txt\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       C.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git commit -m \"version B\"\nCreated commit c1e1cf8: version B\n 2 files changed, 1 insertions(+), 1 deletions(-)\n delete mode 100644 AC.txt\n create mode 100644 BC.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git tag versionB c1e1\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git add *c*.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git commit -m \"version C\"\nCreated commit 66c62fd: version C\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 C.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git tag versionC 66c6\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ rm *.*\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ ls\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git commit -a -m \"version D\"\nCreated commit eee4a13: version D\n 3 files changed, 0 insertions(+), 3 deletions(-)\n delete mode 100644 ABC.txt\n delete mode 100644 BC.txt\n delete mode 100644 C.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git tag versionD eee4\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git status\n# On branch master\nnothing to commit (working directory clean)\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git checkout versionA .\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ ls\nABC.txt  AC.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ rm *.*\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git checkout versionB .\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ ls\nABC.txt  AC.txt  BC.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ rm *.*\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git checkout versionC .\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ ls\nABC.txt  AC.txt  BC.txt  C.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ rm *.*\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ git checkout versionD .\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ ls\nABC.txt  AC.txt  BC.txt  C.txt\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ gitk\n\nconorr@KINKLADZE /w/GITPLATFORM/swproj\n$ comment: gitk shows that versionA & C are correct, but B & D are wrong\n"},{"id":"98996","messageId":"gje4ff$ip6$4@ger.gmane.org","threadId":"16891","inReplyTo":"3ab397d0812301035w3dcd872fkae9509629a0ed7de@mail.gmail.com","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T21:04:13Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Thnks for reviewing !\n\n\"Jeff Whiteside\" <jeff.m.whiteside@gmail.com> wrote in message \nnews:3ab397d0812301035w3dcd872fkae9509629a0ed7de@mail.gmail.com...\n>> commit -a detects that files have been deleted, and takes them out of the \n>> index !\n>> could also have used $ git rm <specific files> and then $ git commit ..\n>\n> hey! i like your changes! the post is pretty polished now.  the only\n> thing else i would change (srysry), is the above.  \"-a detects that\n> files have been deleted\"  -> heh, not true.  you don't need -a here;\n> it does something else.\n\n** haven't had time to review this but from what you say it looks like I \nforgot to take this out\n\n> okay i just recreated your repo and did the same thing.  with your\n> syntax \"git checkout versionA .\" i got the same result, and i'm not\n> sure why, but i think it was because of the detached head.\n\n** at Yves' (demerphq) request I reproduced and posted the exact sequence of \ncommands\nthis was from a reboot, going straight into git bash and running the warmup \nwith NO git-resets at all\n\n> good news, use \"git checkout versionA\", not \"git checkout versionA .\"\n> (so, use it wihtout the dot), and you should be back in working order.\n\n** yes but I don't get the files copied out into the tree which is all my \nlittle heart ever desired\n\n> the other (good?)  news is that you probably _do_ want to be using git\n> reset --hard in your case, because you're trying to build up a history\n> from some project, so you do want to erase some faulty commits after\n> you bodge something or miss some files.\n\n** yes, now I know that git-reset is only for destruction, not navigation\n\n> the bad news is that my opinion is that you should probably move on\n> with your life, because my own past tells me that you'll never\n> actually use those old project versions, hahah :p\n\n** LOL, I have to admit I am enjoying this though, even if its driving me \nslightly potty - haha\nI didn't write these early versions so I just wanna have them around to \nrollback to if I end up hacking the thing to bits.\nBut you're right - chances of using are slim - but you could say that about \nevery version sitting in any given SCM repo.\nThats why we have SCM, and why we insure our cars etc etc. :-) \n"},{"id":"98999","messageId":"200812301549.26538.bss@iguanasuicide.net","threadId":"16891","inReplyTo":"gje3ok$gnc$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss@iguanasuicide.net","sentAt":"2008-12-30T21:49:22Z","receivedAt":"2008-12-30T21:49:22Z","isPatch":false,"sender":{"key":"bss@iguanasuicide.net","avatar":"https://gravatar.com/avatar/84b95eeff194b816c1568b1339e63e4b229825298664a9037b9f1ec713ead1e3?d=mp&s=160"},"body":"On Tuesday 2008 December 30 15:27:33 you wrote:\n> conorr@KINKLADZE /w/GITPLATFORM/swproj\n> $ git status\n> # On branch master\n> nothing to commit (working directory clean)\n>\n> conorr@KINKLADZE /w/GITPLATFORM/swproj\n> $ git checkout versionA .\n>\n> conorr@KINKLADZE /w/GITPLATFORM/swproj\n> $ ls\n> ABC.txt  AC.txt\n>\n> conorr@KINKLADZE /w/GITPLATFORM/swproj\n> $ rm *.*\n>\n> conorr@KINKLADZE /w/GITPLATFORM/swproj\n> $ git checkout versionB .\n>\n> conorr@KINKLADZE /w/GITPLATFORM/swproj\n> $ ls\n> ABC.txt  AC.txt  BC.txt\n\nNot a bug.  git checkout <commit> <paths> does not delete files by design.  \nTry using \"git checkout versionB\" instead (no paths specified), and it will \nproperly remove AC.txt from your working tree as well as warning you \nthat \"You're Doing It Wrong\" (tm).\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss@iguanasuicide.net                     ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.net/                      \\_/     \n"},{"id":"99000","messageId":"3ab397d0812301403y53e0aecbo7f1e153ad3b76de5@mail.gmail.com","threadId":"16891","inReplyTo":"gje4ff$ip6$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Jeff Whiteside","fromEmail":"jeff.m.whiteside@gmail.com","sentAt":"2008-12-30T22:03:38Z","receivedAt":"2008-12-30T22:03:38Z","isPatch":false,"sender":{"key":"jeff.m.whiteside@gmail.com","avatar":null},"body":">> good news, use \"git checkout versionA\", not \"git checkout versionA .\"\n>> (so, use it wihtout the dot), and you should be back in working order.\n>\n> ** yes but I don't get the files copied out into the tree which is all my\n> little heart ever desired\n\nyou dont \"get the files copied out into the tree\"...  i have zero idea\nwhat that means wihtout punctuation and context, but i'm pretty sure\nthat you want to do a \"git checkout versionA\", not  \"git checkout\nversionA .\".  if i'm wrong, then maybe try a git clean?\n\n> But you're right - chances of using are slim - but you could say that about\n> every version sitting in any given SCM repo.\n> Thats why we have SCM, and why we insure our cars etc etc. :-)\n\ni punish myself for saying what i did.  shame on me.  you're totally right.\n"},{"id":"99002","messageId":"200812301617.15496.bss@iguanasuicide.net","threadId":"16891","inReplyTo":"200812301549.26538.bss@iguanasuicide.net","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss@iguanasuicide.net","sentAt":"2008-12-30T22:17:11Z","receivedAt":"2008-12-30T22:17:11Z","isPatch":false,"sender":{"key":"bss@iguanasuicide.net","avatar":"https://gravatar.com/avatar/84b95eeff194b816c1568b1339e63e4b229825298664a9037b9f1ec713ead1e3?d=mp&s=160"},"body":"On Tuesday 2008 December 30 15:49:22 Boyd Stephen Smith Jr. wrote:\n> On Tuesday 2008 December 30 15:27:33 you wrote:\n> > conorr@KINKLADZE /w/GITPLATFORM/swproj\n> > $ git status\n> > # On branch master\n> > nothing to commit (working directory clean)\n> >\n> > conorr@KINKLADZE /w/GITPLATFORM/swproj\n> > $ git checkout versionA .\n> >\n> > conorr@KINKLADZE /w/GITPLATFORM/swproj\n> > $ ls\n> > ABC.txt  AC.txt\n> >\n> > conorr@KINKLADZE /w/GITPLATFORM/swproj\n> > $ rm *.*\n> >\n> > conorr@KINKLADZE /w/GITPLATFORM/swproj\n> > $ git checkout versionB .\n> >\n> > conorr@KINKLADZE /w/GITPLATFORM/swproj\n> > $ ls\n> > ABC.txt  AC.txt  BC.txt\n>\n> Not a bug.  git checkout <commit> <paths> does not delete files by design.\n> Try using \"git checkout versionB\" instead (no paths specified), and it will\n> properly remove AC.txt from your working tree as well as warning you\n> that \"You're Doing It Wrong\" (tm).\n\nThis may be what you want:\n(commands)\nmkdir test && cd test && git init &&\n\necho 'ABC' > ABC.txt && echo 'AC' > AC.txt &&\necho 'BC' > BC.txt && echo 'C' > C.txt &&\n\nfind -name '*C*' -print0 | xargs -r0 -- git add -- &&\ngit commit -m '\"C\" files.' && git branch versionC master &&\n\ngit checkout -b versionA master &&\nfind -type f -not -wholename '*.git*' -not -name '*A*' -print0 | \\\n\txargs -r0 -- git rm -- &&\ngit commit -m 'Removed non-\"A\" files.' &&\n\ngit checkout -b versionB &&\nfind -type f -not -wholename '*.git*' -not -name '*B*' -print0 | \\\n\txargs -r0 -- git rm -- &&\ngit commit -m 'Removed non-\"B\" files.' &&\n\ngit checkout -b versionD master &&\nfind -type f -not -wholename '*.git*' -not -name '*D*' -print0 | \\\n\txargs -r0 -- git rm -- && git commit -m 'Removed non-\"D\" files.' &&\n\ngit checkout master && git branch -v --abbrev=4 && ls -l &&\ngit checkout versionA && ls -l &&\ngit checkout versionB && ls -l &&\ngit checkout versionC && ls -l &&\ngit checkout versionD && ls -l\n\n(output)\n/home/bss/test\nInitialized empty Git repository in /home/bss/test/.git/\nCreated initial commit 8dbf3a1: All files.\n 4 files changed, 4 insertions(+), 0 deletions(-)\n create mode 100644 ABC.txt\n create mode 100644 AC.txt\n create mode 100644 BC.txt\n create mode 100644 C.txt\nSwitched to a new branch \"versionA\"\nrm 'BC.txt'\nrm 'C.txt'\nCreated commit a06e10c: Removed non-\"A\" files.\n 2 files changed, 0 insertions(+), 2 deletions(-)\n delete mode 100644 BC.txt\n delete mode 100644 C.txt\nSwitched to a new branch \"versionB\"\nrm 'AC.txt'\nCreated commit 2029ca2: Removed non-\"B\" files.\n 1 files changed, 0 insertions(+), 1 deletions(-)\n delete mode 100644 AC.txt\nSwitched to a new branch \"versionD\"\nrm 'ABC.txt'\nrm 'AC.txt'\nrm 'BC.txt'\nrm 'C.txt'\nCreated commit 1793ba0: Removed non-\"D\" files.\n 4 files changed, 0 insertions(+), 4 deletions(-)\n delete mode 100644 ABC.txt\n delete mode 100644 AC.txt\n delete mode 100644 BC.txt\n delete mode 100644 C.txt\nSwitched to branch \"master\"\n* master   8dbf \"C\" files.\n  versionA a06e Removed non-\"A\" files.\n  versionB 2029 Removed non-\"B\" files.\n  versionC 8dbf \"C\" files.\n  versionD 1793 Removed non-\"D\" files.\ntotal 16\n-rw-r--r-- 1 bss users 4 2008-12-30 16:10 ABC.txt\n-rw-r--r-- 1 bss users 3 2008-12-30 16:10 AC.txt\n-rw-r--r-- 1 bss users 3 2008-12-30 16:10 BC.txt\n-rw-r--r-- 1 bss users 2 2008-12-30 16:10 C.txt\nSwitched to branch \"versionA\"\ntotal 8\n-rw-r--r-- 1 bss users 4 2008-12-30 16:10 ABC.txt\n-rw-r--r-- 1 bss users 3 2008-12-30 16:10 AC.txt\nSwitched to branch \"versionB\"\ntotal 4\n-rw-r--r-- 1 bss users 4 2008-12-30 16:10 ABC.txt\nSwitched to branch \"versionC\"\ntotal 16\n-rw-r--r-- 1 bss users 4 2008-12-30 16:10 ABC.txt\n-rw-r--r-- 1 bss users 3 2008-12-30 16:10 AC.txt\n-rw-r--r-- 1 bss users 3 2008-12-30 16:10 BC.txt\n-rw-r--r-- 1 bss users 2 2008-12-30 16:10 C.txt\nSwitched to branch \"versionD\"\ntotal 0\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss@iguanasuicide.net                     ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.net/                      \\_/     \n"},{"id":"99006","messageId":"200812301639.17248.bss@iguanasuicide.net","threadId":"16891","inReplyTo":"200812301617.15496.bss@iguanasuicide.net","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Boyd Stephen Smith Jr.","fromEmail":"bss@iguanasuicide.net","sentAt":"2008-12-30T22:39:11Z","receivedAt":"2008-12-30T22:39:11Z","isPatch":false,"sender":{"key":"bss@iguanasuicide.net","avatar":"https://gravatar.com/avatar/84b95eeff194b816c1568b1339e63e4b229825298664a9037b9f1ec713ead1e3?d=mp&s=160"},"body":"On Tuesday 2008 December 30 16:17:11 Boyd Stephen Smith Jr. wrote:\n> git checkout -b versionB &&\n\nShould be:\n\ngit checkout -b versionB master &&\n\nto match the other section and fix this part of the output:\n> Switched to branch \"versionB\"\n> total 4\n> -rw-r--r-- 1 bss users 4 2008-12-30 16:10 ABC.txt\n-- \nBoyd Stephen Smith Jr.                     ,= ,-_-. =. \nbss@iguanasuicide.net                     ((_/)o o(\\_))\nICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' \nhttp://iguanasuicide.net/                      \\_/     \n"},{"id":"99013","messageId":"alpine.LNX.1.00.0812301730440.19665@iabervon.org","threadId":"16891","inReplyTo":"gje4ff$ip6$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-12-30T23:29:17Z","receivedAt":"2008-12-30T23:29:17Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 30 Dec 2008, Zorba wrote:\n\n> > good news, use \"git checkout versionA\", not \"git checkout versionA .\"\n> > (so, use it wihtout the dot), and you should be back in working order.\n> \n> ** yes but I don't get the files copied out into the tree which is all my \n> little heart ever desired\n\nSo in order for this to make sense, you're going to need to know a little \ntiny bit about branches (which, fortunately, is trivial compared to \nbranches in most SCMs). In git, a branch is a mutable pointer to a commit, \nwhich is the latest commit on the branch (all of the earlier commits on \nthe branch are linked off of the latest one; each commit points to the one \nbefore). By default, you have a branch called \"master\", and that's the \nbranch that your series of commands builds up. Now, at any given time, you \ncan have a \"current branch\" (a.k.a. HEAD), which is the branch that you'd \nput a new commit on if you made one. \"master\" is your current branch while \nyou're building up that history.\n\nWhen you want to navigate the history, however, you want to leave all of \nthe branches alone and take your working directory into the history. This \nis known as being on \"(no branch)\" or, as Zippy would say, having a \n\"detached HEAD\". This way you leave the \"master\" branch pointing to \nversionD, which is, after all, the latest commit, while you get yourself \nan old version. You can do this with:\n\n$ git checkout versionA\n\nbecause you've made a tag for it. In order to get back to developing (as \nopposed to looking at history), you use:\n\n$ git checkout master\n\n(because \"master\" is your branch, while \"versionA\" is a tag).\n\nIf you're on master, either after checking it out explicitly or before \nyou've used checkout at all, doing:\n\n$ git checkout versionA .\n\nwith *not* switch you away from the current branch, but will get the \ncontents of \".\" from versionA into your index and working directory, and \nit doesn't remove things that you have currently.\n\n> ** LOL, I have to admit I am enjoying this though, even if its driving me \n> slightly potty - haha\n> I didn't write these early versions so I just wanna have them around to \n> rollback to if I end up hacking the thing to bits.\n> But you're right - chances of using are slim - but you could say that about \n> every version sitting in any given SCM repo.\n> Thats why we have SCM, and why we insure our cars etc etc. :-) \n\nEven if you never rolling back to it, it's useful for figuring out what \nyou did when.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"99021","messageId":"gjeei2$e72$4@ger.gmane.org","threadId":"16891","inReplyTo":"alpine.LNX.1.00.0812301730440.19665@iabervon.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-31T00:22:09Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"> So in order for this to make sense, you're going to need to know a little\n> tiny bit about branches\n\n** (sigh) At some level I knew I'd have to face up to this... - ok lets do \nit\n\n(which, fortunately, is trivial compared to\n> branches in most SCMs). In git, a branch is a mutable pointer to a commit,\n> which is the latest commit on the branch (all of the earlier commits on\n> the branch are linked off of the latest one; each commit points to the one\n> before). By default, you have a branch called \"master\", and that's the\n> branch that your series of commands builds up. Now, at any given time, you\n> can have a \"current branch\" (a.k.a. HEAD), which is the branch that you'd\n> put a new commit on if you made one. \"master\" is your current branch while\n> you're building up that history.\n\n> When you want to navigate the history, however, you want to leave all of\n> the branches alone and take your working directory into the history. This\n> is known as being on \"(no branch)\" or, as Zippy would say, having a\n> \"detached HEAD\". This way you leave the \"master\" branch pointing to\n> versionD, which is, after all, the latest commit, while you get yourself\n> an old version. You can do this with:\n\n> $ git checkout versionA\n>\n> because you've made a tag for it. In order to get back to developing (as\n> opposed to looking at history), you use:\n>\n> $ git checkout master\n>\n> (because \"master\" is your branch, while \"versionA\" is a tag).\n>\n> If you're on master, either after checking it out explicitly or before\n> you've used checkout at all, doing:\n>\n> $ git checkout versionA .\n>\n> with *not* switch you away from the current branch, but will get the\n> contents of \".\" from versionA into your index and working directory, and\n> it doesn't remove things that you have currently.\n\n** ok, thanks for explaining - one little dot and my HEAD don't get a \nholiday !\n\nNow, lets say we checkout versionB. I don't just want to be pointing at \nversionB in the repo, I want an exact copy (no more, no less) of all the \nfiles in version B, to be placed in the working tree. Currently this is not \nhappening reliably.\n\nIs that too much to ask ?\n"},{"id":"99023","messageId":"slrnglljie.kdq.sitaramc@sitaramc.homelinux.net","threadId":"16891","inReplyTo":"gje3ok$gnc$4@ger.gmane.org","subject":"Re: for newbs = little exercise / tutorial / warmup for windows and other non-sophisticated new Git users :-)","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2008-12-31T01:43:42Z","receivedAt":"2008-12-31T01:43:42Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2008-12-30, Zorba <cr@altmore.co.uk> wrote:\n> ** REPRODUCING Possible bug\n\n[long script using \"git checkout tag .\" removed...]\n\nConor,\n\nAs Stephen said, you're using an extra \".\" which changes the\nmeaning completely.\n\nIn addition, the weird behaviour you see, where AC.txt\nappears to have sneaked in when you do a \"git checkout\nversionB .\", even though versionB does not have that file,\nis also correct -- read the second para of the DESCRIPTION\nsection in \"git help checkout\", and note the phrase \"update\nthe index ... before updating the working tree\".\n\nIn other words, the special form of git checkout you used is\nupdating not only the working tree but also the index.  So\nwhen you checked out versionA in this manner, AC.txt got\ninto the index (as well as the working tree).\n\nYour subsequent \"rm *.*\" only deeltes those files from the\nworking tree; they're still in the index.  To see this, run\n\"git ls-files -s\" just after each \"rm *.*\".\n\nYou can also get the results you *want* to get by running a\n\"git reset --hard\" instead of \"rm *.*\", since your top\ncommit in the current branch (which is what this would\ndefault to) has no files in it anyway.\n\nHappy New Year from India to Northern Ireland and everyone\nelse in the world :-)\n"}]}