{"thread":{"id":"29296","subject":"checkout on an empty directory fails","startedAt":"2012-01-05T10:09:29Z","lastAt":"2012-01-05T19:33:25Z","messageCount":7,"participants":["René Doß","Nguyen Thai Ngoc Duy","Ramkumar Ramachandra","Thomas Rast","Holger Hellmuth","Dirk Süsserott"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"181965","messageId":"4F0576D9.4030207@gmx.de","threadId":"29296","inReplyTo":null,"subject":"checkout on an empty directory fails","fromName":"René Doß","fromEmail":"doss@gmx.de","sentAt":"2012-01-05T10:09:29Z","receivedAt":"2012-01-05T10:09:29Z","isPatch":false,"sender":{"key":"doss@gmx.de","avatar":null},"body":"I have a clean derectory ang the git database. Now I want check out the \nmaster.\nThe master is the last commit. The files name  are displayed but not \nstored out in directory.\n\nWhy can not I  check out?\n\nRené Doß\n\n\n\nred@linux-nrd1:~/iso/a> ls -a\n.  ..  .git\nred@linux-nrd1:~/iso/a> git checkout master\nD       SP601_RevC_annotated_master_ucf_8-28-09.ucf\nD       rtl/ether_speed.vhd\nD       rtl/ether_top.vhd\nD       rtl/ether_tx.vhd\nD       rtl/takt.vhd\nD       sim/makefile\nD       sim/tb_ether_top.vhd\nAlready on 'master'\nred@linux-nrd1:~/iso/a> ls\nred@linux-nrd1:~/iso/a>\n"},{"id":"181966","messageId":"CACsJy8A42n4t+WqGaTx7vDQ3jP_YkD1bB0WL9amrrg1B4eOx7w@mail.gmail.com","threadId":"29296","inReplyTo":"4F0576D9.4030207@gmx.de","subject":"Re: checkout on an empty directory fails","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2012-01-05T11:06:45Z","receivedAt":"2012-01-05T11:06:45Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Jan 5, 2012 at 5:09 PM, René Doß <doss@gmx.de> wrote:\n> I have a clean derectory ang the git database. Now I want check out the\n> master.\n> The master is the last commit. The files name  are displayed but not stored\n> out in directory.\n>\n> Why can not I  check out?\n\ntry \"git checkout .\" but be careful because this command overwrites\nany changes you have in the directory.\n\n>\n> red@linux-nrd1:~/iso/a> ls -a\n> .  ..  .git\n> red@linux-nrd1:~/iso/a> git checkout master\n> D       SP601_RevC_annotated_master_ucf_8-28-09.ucf\n> D       rtl/ether_speed.vhd\n> D       rtl/ether_top.vhd\n> D       rtl/ether_tx.vhd\n> D       rtl/takt.vhd\n> D       sim/makefile\n> D       sim/tb_ether_top.vhd\n> Already on 'master'\n> red@linux-nrd1:~/iso/a> ls\n> red@linux-nrd1:~/iso/a>\n-- \nDuy\n"},{"id":"181967","messageId":"CALkWK0knVa3V9mX86WhmXmC3_SBPitgAzh_9RAXmWeQcgf=hRw@mail.gmail.com","threadId":"29296","inReplyTo":"4F0576D9.4030207@gmx.de","subject":"Re: checkout on an empty directory fails","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2012-01-05T11:07:16Z","receivedAt":"2012-01-05T11:07:16Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi René,\n\nRené Doß wrote:\n> I have a clean derectory ang the git database. Now I want check out the\n> master.\n> [...]\n>\n> red@linux-nrd1:~/iso/a> ls -a\n> .  ..  .git\n> red@linux-nrd1:~/iso/a> git checkout master\n> D       SP601_RevC_annotated_master_ucf_8-28-09.ucf\n> [...]\n\nIn such situations, \"git status\" usually has something helpful to say.\n You're already on the \"master\" branch, and you can reset your\nworktree with `git reset --hard` (caution: please read the manpage).\n\n-- Ram\n"},{"id":"181968","messageId":"87d3ayz9k3.fsf@thomas.inf.ethz.ch","threadId":"29296","inReplyTo":"4F0576D9.4030207@gmx.de","subject":"Re: checkout on an empty directory fails","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-01-05T11:13:32Z","receivedAt":"2012-01-05T11:13:32Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"René Doß <doss@gmx.de> writes:\n\n> I have a clean derectory ang the git database. Now I want check out\n> the master.\n\nOk, but why?  What problem were you really trying to solve?\n\n> red@linux-nrd1:~/iso/a> git checkout master\n> D       SP601_RevC_annotated_master_ucf_8-28-09.ucf\n> D       rtl/ether_speed.vhd\n> D       rtl/ether_top.vhd\n> D       rtl/ether_tx.vhd\n> D       rtl/takt.vhd\n> D       sim/makefile\n> D       sim/tb_ether_top.vhd\n> Already on 'master'\n\ngit-checkout considers this an uncommitted change compared to the\ncurrent branch (HEAD).  It actually ensures that you do not lose such\nchanges.\n\nTo get your files back, you can use the file-argument form of checkout\n\n  git checkout -- .\n\nor the \"really give me back the HEAD state, period\" form of git-reset\n\n  git reset --hard\n\nBoth of those *will* destroy uncommitted changes with no recourse or\nbackup, so be careful.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"},{"id":"181971","messageId":"4F0599E0.7090902@gmx.de","threadId":"29296","inReplyTo":"CACsJy8A42n4t+WqGaTx7vDQ3jP_YkD1bB0WL9amrrg1B4eOx7w@mail.gmail.com","subject":"RE: Re: checkout on an empty directory fails","fromName":"René Doß","fromEmail":"doss@gmx.de","sentAt":"2012-01-05T12:38:56Z","receivedAt":"2012-01-05T12:38:56Z","isPatch":false,"sender":{"key":"doss@gmx.de","avatar":null},"body":"  Thank you for your help. I can not understand what is the mistake?  \nqgit displays me the tree correct.\ngit status says not special informations.\nOnly git  checkout .    works.\n\nWhat means the point in checkout?\n\n\n\nRené\n\n\nred@linux-nrd1:~/iso/a> git status\n# On branch master\n# Changed but not updated:\n#   (use \"git add/rm <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working \ndirectory)\n#\n#       deleted:    SP601_RevC_annotated_master_ucf_8-28-09.ucf\n#       deleted:    rtl/ether_speed.vhd\n#       deleted:    rtl/ether_top.vhd\n#       deleted:    rtl/ether_tx.vhd\n#       deleted:    rtl/takt.vhd\n#       deleted:    sim/makefile\n#       deleted:    sim/tb_ether_top.vhd\n#\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n\ned@linux-nrd1:~/iso/a> ls\nred@linux-nrd1:~/iso/a> git reset --hard\nHEAD is now at efb7b86 Simulation ergaenzt\nred@linux-nrd1:~/iso/a> git checkout master\nAlready on 'master'\nred@linux-nrd1:~/iso/a> git checkout .\nred@linux-nrd1:~/iso/a> ls\nrtl  sim  SP601_RevC_annotated_master_ucf_8-28-09.ucf <--here are the \nfiles back!!!!\nred@linux-nrd1:~/iso/a>\n"},{"id":"181974","messageId":"4F05ACD6.6040603@ira.uka.de","threadId":"29296","inReplyTo":"4F0599E0.7090902@gmx.de","subject":"Re: checkout on an empty directory fails","fromName":"Holger Hellmuth","fromEmail":"hellmuth@ira.uka.de","sentAt":"2012-01-05T13:59:50Z","receivedAt":"2012-01-05T13:59:50Z","isPatch":false,"sender":{"key":"hellmuth@ira.uka.de","avatar":null},"body":"On 05.01.2012 13:38, René Doß wrote:\n> git status says not special informations.\n\n  versus\n\n> red@linux-nrd1:~/iso/a> git status\n> # On branch master\n> # Changed but not updated:\n> # (use \"git add/rm <file>...\" to update what will be committed)\n> # (use \"git checkout -- <file>...\" to discard changes in working directory)\n> #\n> # deleted: SP601_RevC_annotated_master_ucf_8-28-09.ucf\n> # deleted: rtl/ether_speed.vhd\n> # deleted: rtl/ether_top.vhd\n> # deleted: rtl/ether_tx.vhd\n> # deleted: rtl/takt.vhd\n> # deleted: sim/makefile\n> # deleted: sim/tb_ether_top.vhd\n> #\n\nThis *is* special information: It tells you that master has those 7 \nfiles but your working directory has none of them (i.e. it is as if you \nhad deleted them from your working directory).\n\n\"git checkout <branch>\" switches between branches, *but* leaves changes \nyou made (files you edited, added or deleted) intact! This is so you can \nswitch branches before commiting if you suddenly realize you are in the \nwrong branch.\n\n\"git checkout -- <paths...>\" or in your case \"git checkout -- .\" is \ndifferent, it really overwrites the files in your working dir with the \nversions stored somewhere else, by default from the index.\n\n > What means the point in checkout?\n\n\".\" is simply your current directory\n"},{"id":"181987","messageId":"4F05FB05.3090706@dirk.my1.cc","threadId":"29296","inReplyTo":"4F05ACD6.6040603@ira.uka.de","subject":"Re: checkout on an empty directory fails","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2012-01-05T19:33:25Z","receivedAt":"2012-01-05T19:33:25Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Am 05.01.2012 14:59 schrieb Holger Hellmuth:\n> On 05.01.2012 13:38, René Doß wrote:\n>> git status says not special informations.\n> \n>  versus\n> \n>> red@linux-nrd1:~/iso/a> git status\n>> # On branch master\n>> # Changed but not updated:\n>> # (use \"git add/rm <file>...\" to update what will be committed)\n>> # (use \"git checkout -- <file>...\" to discard changes in working\n>> directory)\n>> #\n>> # deleted: SP601_RevC_annotated_master_ucf_8-28-09.ucf\n>> # deleted: rtl/ether_speed.vhd\n>> # deleted: rtl/ether_top.vhd\n>> # deleted: rtl/ether_tx.vhd\n>> # deleted: rtl/takt.vhd\n>> # deleted: sim/makefile\n>> # deleted: sim/tb_ether_top.vhd\n>> #\n> \n> This *is* special information: It tells you that master has those 7\n> files but your working directory has none of them (i.e. it is as if you\n> had deleted them from your working directory).\n> \n> \"git checkout <branch>\" switches between branches, *but* leaves changes\n> you made (files you edited, added or deleted) intact! This is so you can\n> switch branches before commiting if you suddenly realize you are in the\n> wrong branch.\n> \n> \"git checkout -- <paths...>\" or in your case \"git checkout -- .\" is\n> different, it really overwrites the files in your working dir with the\n> versions stored somewhere else, by default from the index.\n> \n>> What means the point in checkout?\n> \n> \".\" is simply your current directory\n\nAnother way of reviving the deleted files and restore the master branch is\n\n$ git checkout -f master # or git checkout --force master\n\nThis will unconditionally checkout master and overwrite the local\nchanges, including the deletions Holger mentioned.\n\nFor me, \"checkout --force\" is more intuitive than \"reset --hard\" or\n\"checkout .\".\n\n    Dirk\n"}]}