{"thread":{"id":"16873","subject":"getting started, happy with cmd line on windows [Scanned]","startedAt":"2008-12-26T13:44:44Z","lastAt":"2008-12-30T01:15:45Z","messageCount":7,"participants":["Conor Rafferty","René Scharfe","Zorba","Junio C Hamano","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"98730","messageId":"BB5F02FD3789B54E8964D38D6775E718242D07@ALTMORE-SVR.altmore.local","threadId":"16873","inReplyTo":null,"subject":"getting started, happy with cmd line on windows [Scanned]","fromName":"Conor Rafferty","fromEmail":"conor.rafferty@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-26T13:44:44Z","isPatch":false,"sender":{"key":"conor.rafferty@altmore.co.uk","avatar":null},"body":"We want to use git to\na) archive old versions of our project that have till now had no SCM\napplied\nb) moving forward, provide robust SCM on new versions of project\n\nJust to get familiar, I created a folder, ran\n\n$ git init\n\nthen created a few files: ABC.txt, AC.txt, BC.txt, C.txt This mimics our\nreal life sitch for purpose (a), files are in version A, but not in\nversion B, which introduces new files, whick might not be in version C\n\n$ git add *c*.txt\n$ git commit -m \"version A\"\n\nso now ABC.txt and AC.txt are in the repo, at a commit with comment\n\"version A\"\n\n$ git show\n\nconfirms this\n\n$ git status\n\nconfirms that BC.txt and C.txt have not been tracked - great, as\ndesigned\n\nI then deleted all files from the working directory, so I can pull out\nONLY the ones in version A.\nI tried both fetch and checkout - but nothing was copied into working\ndir How do I do this ?\n\nNB along the way I also tagged this first commit as \"tag_versionA\"\nalso tried\n\n$ git checkout tag_versionA\nwhich changed HEAD back to version A, but didn't create the files\n\nSeems like I'm missing some fundamental concepts here - from other\nSCM's, I understood fetch or checkout would copy files into your working\ndir that were replicas of the versions stored in repository\n\n\n\n\n\n\n\n\n-- \n\n \n<http://www.altmore.co.uk/xNON_SITE/SignatureFiles/AltmoreIT_signature_l\nogo.JPG> \n\nConor Rafferty BSc (Hons.)\nREGIONAL MANAGER\nAltmore IT Recruitment\nTownsend Enterprise Park\n28 Townsend Street\nBelfast BT13 2ES \n\nT: +44 (0)28 9032 8400\nE: conor.rafferty@altmore.co.uk\nW: www.altmore.co.uk <http://www.altmore.co.uk/>  \n\nLinkedIn: http://www.linkedin.com/in/conorrafferty\n\n________________________________\n\nThis electronic message contains information from Altmore IT Recruitment\nwhich may be privileged or confidential. The information is intended to\nbe for the use of the individual(s) or entity named above. If you are\nnot the intended recipient be aware that any disclosure, copying\ndistribution or use of the contents of this information is prohibited.\nIf you have received this electronic message in error, please notify us\nby telephone or email (to the numbers or address above) immediately.\n"},{"id":"98734","messageId":"495508B9.7070103@lsrfire.ath.cx","threadId":"16873","inReplyTo":"BB5F02FD3789B54E8964D38D6775E718242D07@ALTMORE-SVR.altmore.local","subject":"Re: getting started, happy with cmd line on windows [Scanned]","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2008-12-26T16:39:21Z","receivedAt":"2008-12-26T16:39:21Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Conor Rafferty schrieb:\n> I then deleted all files from the working directory, so I can pull out\n> ONLY the ones in version A.\n> I tried both fetch and checkout - but nothing was copied into working\n> dir How do I do this ?\n\ngit treats deleted files just like edited files: as having been changed\nin preparation for the next commit.  You can get back all of the tracked\nfiles using this command:\n\n\t$ git reset --hard\n\nIt undoes _all_ changes: tracked edited files will be reverted to their\nin-repository state, deleted files created again.  You can also check\nout individual files like this:\n\n\t$ git checkout ABC.txt\n\nIf you just want to get rid of untracked files, you'd use the command\n\"git clean\".\n\nIn general, if you switch your work tree from one revision to another\n(git checkout), git tries to minimize the I/O needed.  Files that are\nthe same in both aren't touched.\n\nRené\n"},{"id":"98749","messageId":"gj3of4$pr3$3@ger.gmane.org","threadId":"16873","inReplyTo":"495508B9.7070103@lsrfire.ath.cx","subject":"Re: getting started, happy with cmd line on windows [Scanned]","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-26T23:08:06Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"> I then deleted all files from the working directory, so I can pull out\n> ONLY the ones in version A.\n> I tried both fetch and checkout - but nothing was copied into working\n> dir How do I do this ?\n\ngit treats deleted files just like edited files: as having been changed\nin preparation for the next commit.  You can get back all of the tracked\nfiles using this command:\n\n$ git reset --hard\n\nIt undoes _all_ changes: tracked edited files will be reverted to their\nin-repository state, deleted files created again.  You can also check\nout individual files like this:\n\n$ git checkout ABC.txt\n\nIf you just want to get rid of untracked files, you'd use the command\n\"git clean\".\n\nIn general, if you switch your work tree from one revision to another\n(git checkout), git tries to minimize the I/O needed.  Files that are\nthe same in both aren't touched.\n\n>>>>>>>>>>>>>>>>>>>\n\nHi Rene,\n\nThanks for taking the time.\n\nMy workflow is such that I inherit projects that are hard to debug and I \nneed to hack around a lot changing a lot of files to output tracking msgs \njust to learn the code's functionality (e,g, PHP on a webserver), but these \nchanges I never intend to keep. After learning the code, I want to go back \nto a \"last known good\". I.e. a previous stable version and start making \nproper changes.\n\nIn other SCMs, there was a way to \"discard\" all local changes, after the \nhacking phase, without EVER having had to commit.\n\nFor a while it seemed like you were telling me I had to COMMIT my hacked \ncode (against all my instincts :-), and THEN rollback ($ git reset --hard).\n\nNow, I went back and read the manual pages for git-checkout and think I see \nhow to do it....\n\n$ <import code>\n$ git init\n$ git commit\n$ git tag versionA <commitID>\n$ hack hack hack\n...\nnow ready to start coding, want \"last known good\"\n$ rm *.*\n$ git checkout versionA .\n\nThis worked fine when versionA had only files and no dirs - but will it work \nok still if versionA is a proper tree ?\n(more of a unix question I suppose - will \".\" suffice as the path ?) \n"},{"id":"98752","messageId":"7v4p0qlcnc.fsf@gitster.siamese.dyndns.org","threadId":"16873","inReplyTo":"gj3of4$pr3$3@ger.gmane.org","subject":"Re: getting started, happy with cmd line on windows [Scanned]","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-26T23:50:15Z","receivedAt":"2008-12-26T23:50:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Zorba\" <cr@altmore.co.uk> writes:\n\n> Now, I went back and read the manual pages for git-checkout and think I see \n> how to do it....\n>\n> $ <import code>\n> $ git init\n> $ git commit\n> $ git tag versionA <commitID>\n> $ hack hack hack\n> ...\n> now ready to start coding, want \"last known good\"\n> $ rm *.*\n> $ git checkout versionA .\n>\n> This worked fine when versionA had only files and no dirs - but will it work \n> ok still if versionA is a proper tree ?\n> (more of a unix question I suppose - will \".\" suffice as the path ?) \n\nDrop \"rm *.*\".  Instead, probably what you want is\n\n> $ <import code>\n> $ git init\n> $ git commit\n\nwhich is a good way to make an initial import.\n\n> $ git tag versionA <commitID>\n> $ hack hack hack\n> ...\n\nand you futzed with the codebase without any intention of committing;\nit is nice to be able to experiment freely.\n\nAfter you are done experimenting,\n\n$ git reset --hard versionA\n\nif you did not make any commit, or even if you did commit while you were\nexperimenting, if you do not want these experimental commits at all.\n\nNo need for \"rm *.*\" anywhere.\n"},{"id":"98771","messageId":"gj43am$fu6$3@ger.gmane.org","threadId":"16873","inReplyTo":"7v4p0qlcnc.fsf@gitster.siamese.dyndns.org","subject":"Re: getting started, happy with cmd line on windows [Scanned]","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-27T02:00:17Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"> Drop \"rm *.*\".  Instead, probably what you want is\n>\n>> $ <import code>\n>> $ git init\n>> $ git commit\n>\n> which is a good way to make an initial import.\n>\n>> $ git tag versionA <commitID>\n>> $ hack hack hack\n>> ...\n>\n> and you futzed with the codebase without any intention of committing;\n> it is nice to be able to experiment freely.\n>\n> After you are done experimenting,\n>\n> $ git reset --hard versionA\n>\n> if you did not make any commit, or even if you did commit while you were\n> experimenting, if you do not want these experimental commits at all.\n>\n> No need for \"rm *.*\" anywhere.\n\nHi Junio,\n\nYes, I had not considered the possibility of being able to reset to last \ncommit (as manual page talked about UNDOing commits). $git reset -hard HEAD \n= This is great, and gives me the functionality I want, get back to the last \nconscious commit after hacking.\n\nI've noticed since discovering this that the Reset function on the Win GUI \nwill ONLY let you reset as far as but not beyond the last commit (i.e. \nunable to undo any commits) so I can use that too.\n\nThe other functionality I was looking for is being able to handle a changing \n\"portfolio\" of files from version to version:\n\ne.g.\nversion A = ABC.txt, AB.txt, AC.txt\nversion B = ABC.txt, AB.txt\nversion C = ABC.txt, AC.txt\nversion D = no files\n\nI'm sure this is a common scenario, for ppl starting out with git as they \nload up versions that till now have been sitting in file systems.\n\nBy using git-add and git-rm (or git-commit -a) I was able to have my \nadd/remove files to the index in \"staging\" and in the end the versions in \nthe repo match up to real life example. Then I can --hard reset back to any \nof these, and ONLY got the files that were in that version.\n\nIts a shame though that git-commit -a only removes files from the index, and \ndoesn't add files to the index, otherwise creating new versions is just a \ncase of importing the files needed for eacch version and cranking..\n\n$ git commit -a\n\nrepeatedly.\n\nBut thanks to all who helped me on this one, and who knows maybe this post \nwill help some other pilgrim following after me\n:-)\nSeason's geetings,\nCR \n"},{"id":"98845","messageId":"alpine.LNX.1.00.0812281326300.19665@iabervon.org","threadId":"16873","inReplyTo":"BB5F02FD3789B54E8964D38D6775E718242D07@ALTMORE-SVR.altmore.local","subject":"Re: getting started, happy with cmd line on windows [Scanned]","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-12-28T18:39:48Z","receivedAt":"2008-12-28T18:39:48Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Fri, 26 Dec 2008, Conor Rafferty wrote:\n\n> We want to use git to\n> a) archive old versions of our project that have till now had no SCM\n> applied\n\nThere's actually an importer for this; if you can put all of the old \nversions into tar files in the same format and list them in order, you can \nuse \"import-tars.perl\", which is in contrib/fast-import in the git source \ntree. Of course, using that won't teach you anything about the tools, but \nit might be the best way to get the real import done with the least chance \nof mistakes.\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"98932","messageId":"gjbt63$v8t$4@ger.gmane.org","threadId":"16873","inReplyTo":"alpine.LNX.1.00.0812281326300.19665@iabervon.org","subject":"Re: getting started, happy with cmd line on windows [Scanned]","fromName":"Zorba","fromEmail":"cr@altmore.co.uk","sentAt":null,"receivedAt":"2008-12-30T01:15:45Z","isPatch":false,"sender":{"key":"cr@altmore.co.uk","avatar":null},"body":"Thanks Daniel, I'm not a tar man anyhow, so that would be one more thing to \nlearn.\nSo I'll pass, but someone else into unix will find this useful (maybe me, a \nfew mths down the track)\n\nBelieve it or not, I had budgeted half a day for getting git installed, \nlearned, and all the versions safely stowed away.\nThat was on Xmas eve (24th Dec.)\n\nI've been on this every day since - gawd, its becoming an Odyssey.\n\nSCM is a support to my software development, which is a support to my \nbusiness (a user business, not technology based) and iin a normal year (not \nlike this current one) would be <10% of our effort. I can sense the beauty \nof git, but A WEEK ! to get close to making the first LIVE COMMIT.\n\nI'm going to assert that a large number of possible users will not be \ninterested, or how shall I put it better, they'l be very interested in git, \nbut that's where it will stay. The blogosphere is littered with the burnt \nbodies of those who have tried to ride this dragon. Gawd its tempting to \ngive up and install CVS or something, the only thing keeping me going is \nthat I HATE quitting !\n\nWhat is it about this stuff ? I am not unintelligent but struggling with \nthis.\n\nIt seems like to do something simple you have to understand EVERYTHING -\nits not like other systems with a clear set of \"basic\", \"intermediate\" and \n\"advanced\" commands that are fairly standalone.\n\neverything in git seems so interleaved - its like relativity, or nuclear \nphysics !\nI'm sure git nirvana is coming sometiime for me,\ngawd please may it be in this lifetime!\n :-)\n\n\"Daniel Barkalow\" <barkalow@iabervon.org> wrote in message \nnews:alpine.LNX.1.00.0812281326300.19665@iabervon.org...\n> On Fri, 26 Dec 2008, Conor Rafferty wrote:\n>\n>> We want to use git to\n>> a) archive old versions of our project that have till now had no SCM\n>> applied\n>\n> There's actually an importer for this; if you can put all of the old\n> versions into tar files in the same format and list them in order, you can\n> use \"import-tars.perl\", which is in contrib/fast-import in the git source\n> tree. Of course, using that won't teach you anything about the tools, but\n> it might be the best way to get the real import done with the least chance\n> of mistakes.\n>\n> -Daniel\n> *This .sig left intentionally blank* \n"}]}