{"thread":{"id":"30075","subject":"Definition of working directory","startedAt":"2012-03-27T16:12:45Z","lastAt":"2012-03-28T16:31:19Z","messageCount":11,"participants":["Anjib Mulepati","Junio C Hamano","Kevin","jaseem abid"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"187863","messageId":"BLU0-SMTP1958653CC391F120060F8B6B14A0@phx.gbl","threadId":"30075","inReplyTo":null,"subject":"Definition of working directory","fromName":"Anjib Mulepati","fromEmail":"anjibcs@hotmail.com","sentAt":"2012-03-27T16:12:45Z","receivedAt":"2012-03-27T16:12:45Z","isPatch":false,"sender":{"key":"anjibcs@hotmail.com","avatar":"https://gravatar.com/avatar/7ac86efaee717c505c8eaabde7f28e645eae076024b9761dc426b6b77ff4f2a0?d=mp&s=160"},"body":"I was reading Git Community Book and came across following definition \nfor working directory\n\nThe Working Directory\n\nThe Git 'working directory' is the directory that holds the current \ncheckout of the files you are working on. Files in this directory are \noften removed or replaced by Git as you switch branches - this is \nnormal. All your history is stored in the Git Directory; the working \ndirectory is simply a temporary checkout place where you can modify the \nfiles until your next commit.\n\nWhat does it mean by this \" Files in this directory are often removed or \nreplaced by Git as you switch branches\"?\n\nAnd does working directory is just a directory we get with $pwd ?\n\nThanks,\nAnjib\n"},{"id":"187866","messageId":"7vd37yj7h2.fsf@alter.siamese.dyndns.org","threadId":"30075","inReplyTo":"BLU0-SMTP1958653CC391F120060F8B6B14A0@phx.gbl","subject":"Re: Definition of working directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-27T17:10:01Z","receivedAt":"2012-03-27T17:10:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Anjib Mulepati <anjibcs@hotmail.com> writes:\n\n> I was reading Git Community Book and came across following definition\n> for working directory\n>\n> The Working Directory\n>\n> The Git 'working directory' is the directory that holds the current\n> checkout of the files you are working on. Files in this directory are\n> often removed or replaced by Git as you switch branches - this is\n> normal. All your history is stored in the Git Directory; the working\n> directory is simply a temporary checkout place where you can modify\n> the files until your next commit.\n>\n> What does it mean by this \" Files in this directory are often removed\n> or replaced by Git as you switch branches\"?\n\nI think the common terminology for the concept the above describes is \"the\nworking tree\".\n\n> And does working directory is just a directory we get with $pwd ?\n\nAfter you clone, you have one directory that contains all the files from\none specific version in it.  The files may be organized into directory\nhierarchy, but there is a single top-level directory.\n\nThat is the \"working tree\".  When we want to be absolutely clear, we may\neven say \"the top of the working tree\", even though it may be redundant.\n\nIf you are at such a directory, $(pwd) may match it.  If you chdir to a\nsubdirectory from there, e.g. \"cd Documentation\", $(pwd) and the top of\nthe working tree will of course disagree.\n\nThe files checked out in the working tree represent the contents of the\nversion that was checked out, plus modifications you make locally.  When\nyou check out a different branch (people coming from svn background may\nsay \"switch branch\", but it is the same thing), the working tree will need\nto represent the contents of the version at the tip of that different\nbranch.  If you have a file in the current branch but not in that\ndifferent branch you are checking out, that file has to go away.  If you\ndo not have a file in the current branch but not in that different branch\nyou are checking out, that file needs to be created in the working tree.\nIf the contents of a file is different between your current branch and the\nbranch you are checking out, the file in the working tree needs to be\nupdated to match that of the branch you are checking out. That is what the\n\"... are often removed or replaced\" part is talking about.\n"},{"id":"187896","messageId":"BLU0-SMTP4376CA011AD4D79C1BAB727B14A0@phx.gbl","threadId":"30075","inReplyTo":"7vd37yj7h2.fsf@alter.siamese.dyndns.org","subject":"Re: Definition of working directory","fromName":"Anjib Mulepati","fromEmail":"anjibcs@hotmail.com","sentAt":"2012-03-27T21:26:23Z","receivedAt":"2012-03-27T21:26:23Z","isPatch":false,"sender":{"key":"anjibcs@hotmail.com","avatar":"https://gravatar.com/avatar/7ac86efaee717c505c8eaabde7f28e645eae076024b9761dc426b6b77ff4f2a0?d=mp&s=160"},"body":"So if I have a project called MyProject and inside that I have two \nsub-directories dir1 and dir2. Does that mean working directory is \n*ALWAYS* MyProject.\n\nAlso if i create some file in dir1 and do git status without git add \nthen it display untracked files as ../dir1/\nIt doesn't display the untracked file name but after I do git add when I \ndid git status it does give me file under changes to be committed. Why \ndidn't it shows file with name as untracked in first case?\n\nOn 3/27/2012 1:10 PM, Junio C Hamano wrote:\n> Anjib Mulepati<anjibcs@hotmail.com>  writes:\n>\n>> I was reading Git Community Book and came across following definition\n>> for working directory\n>>\n>> The Working Directory\n>>\n>> The Git 'working directory' is the directory that holds the current\n>> checkout of the files you are working on. Files in this directory are\n>> often removed or replaced by Git as you switch branches - this is\n>> normal. All your history is stored in the Git Directory; the working\n>> directory is simply a temporary checkout place where you can modify\n>> the files until your next commit.\n>>\n>> What does it mean by this \" Files in this directory are often removed\n>> or replaced by Git as you switch branches\"?\n> I think the common terminology for the concept the above describes is \"the\n> working tree\".\n>\n>> And does working directory is just a directory we get with $pwd ?\n> After you clone, you have one directory that contains all the files from\n> one specific version in it.  The files may be organized into directory\n> hierarchy, but there is a single top-level directory.\n>\n> That is the \"working tree\".  When we want to be absolutely clear, we may\n> even say \"the top of the working tree\", even though it may be redundant.\n>\n> If you are at such a directory, $(pwd) may match it.  If you chdir to a\n> subdirectory from there, e.g. \"cd Documentation\", $(pwd) and the top of\n> the working tree will of course disagree.\n>\n> The files checked out in the working tree represent the contents of the\n> version that was checked out, plus modifications you make locally.  When\n> you check out a different branch (people coming from svn background may\n> say \"switch branch\", but it is the same thing), the working tree will need\n> to represent the contents of the version at the tip of that different\n> branch.  If you have a file in the current branch but not in that\n> different branch you are checking out, that file has to go away.  If you\n> do not have a file in the current branch but not in that different branch\n> you are checking out, that file needs to be created in the working tree.\n> If the contents of a file is different between your current branch and the\n> branch you are checking out, the file in the working tree needs to be\n> updated to match that of the branch you are checking out. That is what the\n> \"... are often removed or replaced\" part is talking about.\n>\n>\n>\n>\n"},{"id":"187899","messageId":"7v8vilzm06.fsf@alter.siamese.dyndns.org","threadId":"30075","inReplyTo":"BLU0-SMTP4376CA011AD4D79C1BAB727B14A0@phx.gbl","subject":"Re: Definition of working directory","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-27T23:01:45Z","receivedAt":"2012-03-27T23:01:45Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Anjib Mulepati <anjibcs@hotmail.com> writes:\n\n> So if I have a project called MyProject and inside that I have two\n> sub-directories dir1 and dir2. Does that mean working directory is\n> *ALWAYS* MyProject.\n\nYour working tree is MyProject that has two subdirectories dir1 and dir2.\n\n> Also if i create some file in dir1 and do git status without git add\n> then it display untracked files as ../dir1/\n> It doesn't display the untracked file name but after I do git add when\n> I did git status it does give me file under changes to be\n> committed. Why didn't it shows file with name as untracked in first\n> case?\n\nBecause often such a directory has tons of garbage files that are totally\nuninteresting.  Check \"git help status\" and look for the --untracked-files\noption if you want to learn more.\n"},{"id":"187914","messageId":"20120328060636.GA2836@ikke-laptop.buyways.nl","threadId":"30075","inReplyTo":"BLU0-SMTP4376CA011AD4D79C1BAB727B14A0@phx.gbl","subject":"Re: Definition of working directory","fromName":"Kevin","fromEmail":"compufreak@gmail.com","sentAt":"2012-03-28T06:06:36Z","receivedAt":"2012-03-28T06:06:36Z","isPatch":false,"sender":{"key":"compufreak@gmail.com","avatar":"https://gravatar.com/avatar/10ca3ab6beccce3bbb196f655727a5ece331d2c95062270ef9d52e64f0d9356b?d=mp&s=160"},"body":"On Tue, Mar 27, 2012 at 05:26:23PM -0400, Anjib Mulepati wrote:\n> So if I have a project called MyProject and inside that I have two\n> sub-directories dir1 and dir2. Does that mean working directory is\n> *ALWAYS* MyProject.\n\nTo be clear, the working directory or working tree is not necessarily a\npath, but refers to the whole tree structure, so every file that belongs\nto the repository.\n"},{"id":"187921","messageId":"CAH-tXsCG5c-z_P-Uw7h72847e0ThfFREFVKkqcG77LuF4fQoTA@mail.gmail.com","threadId":"30075","inReplyTo":"BLU0-SMTP4376CA011AD4D79C1BAB727B14A0@phx.gbl","subject":"Re: Definition of working directory","fromName":"jaseem abid","fromEmail":"jaseemabid@gmail.com","sentAt":"2012-03-28T09:40:52Z","receivedAt":"2012-03-28T09:40:52Z","isPatch":false,"sender":{"key":"jaseemabid@gmail.com","avatar":"https://gravatar.com/avatar/8b0432c96e4d3c8a9a96c9961ee842df7b7a869744da9c25187a51a992eabd81?d=mp&s=160"},"body":"On Wed, Mar 28, 2012 at 2:56 AM, Anjib Mulepati <anjibcs@hotmail.com> wrote:\n>\n> So if I have a project called MyProject and inside that I have two\n> sub-directories dir1 and dir2. Does that mean working directory is *ALWAYS*\n> MyProject.\n\nYes. It is MyProject.\n\n> Also if i create some file in dir1 and do git status without git add then\n> it display untracked files as ../dir1/\n> It doesn't display the untracked file name but after I do git add when I\n> did git status it does give me file under changes to be committed. Why\n> didn't it shows file with name as untracked in first case?\n\nOften there will be build folders with too many unwanted files to\nignore. Unless at least a single file in a directory is tracked, git\nwill ignore the folder. This is afaik a good feature and not a\nproblem.\n\nPS: I am not really a git expert. Please correct me if I'm wrong.\n\n--\nJaseem Abid\n+91 8891 72 43 72\nS6 CSE student\nNational Institute of Technology , Calicut.\n"},{"id":"187929","messageId":"BLU0-SMTP479C08A291DA7BEA81F1875B14B0@phx.gbl","threadId":"30075","inReplyTo":"7vd37yj7h2.fsf@alter.siamese.dyndns.org","subject":"Working directory managment","fromName":"Anjib Mulepati","fromEmail":"anjibcs@hotmail.com","sentAt":"2012-03-28T14:10:46Z","receivedAt":"2012-03-28T14:10:46Z","isPatch":false,"sender":{"key":"anjibcs@hotmail.com","avatar":"https://gravatar.com/avatar/7ac86efaee717c505c8eaabde7f28e645eae076024b9761dc426b6b77ff4f2a0?d=mp&s=160"},"body":"So these removed or replaced is done automatically or as I understood we \ndo merge and and see conflict and do changes as per necessary?\n\nI was reading Git Community Book and came across following definition\nfor working directory\n\nThe Working Directory\n\nThe Git 'working directory' is the directory that holds the current\ncheckout of the files you are working on. Files in this directory are\noften removed or replaced by Git as you switch branches - this is\nnormal. All your history is stored in the Git Directory; the working\ndirectory is simply a temporary checkout place where you can modify\nthe files until your next commit.\n\nWhat does it mean by this \" Files in this directory are often removed\nor replaced by Git as you switch branches\"?\n\n> I think the common terminology for the concept the above describes is \"the\n> working tree\".\n>\n>> And does working directory is just a directory we get with $pwd ?\n> After you clone, you have one directory that contains all the files from\n> one specific version in it.  The files may be organized into directory\n> hierarchy, but there is a single top-level directory.\n>\n> That is the \"working tree\".  When we want to be absolutely clear, we may\n> even say \"the top of the working tree\", even though it may be redundant.\n>\n> If you are at such a directory, $(pwd) may match it.  If you chdir to a\n> subdirectory from there, e.g. \"cd Documentation\", $(pwd) and the top of\n> the working tree will of course disagree.\n>\n> The files checked out in the working tree represent the contents of the\n> version that was checked out, plus modifications you make locally.  When\n> you check out a different branch (people coming from svn background may\n> say \"switch branch\", but it is the same thing), the working tree will need\n> to represent the contents of the version at the tip of that different\n> branch.  If you have a file in the current branch but not in that\n> different branch you are checking out, that file has to go away.  If you\n> do not have a file in the current branch but not in that different branch\n> you are checking out, that file needs to be created in the working tree.\n> If the contents of a file is different between your current branch and the\n> branch you are checking out, the file in the working tree needs to be\n> updated to match that of the branch you are checking out. That is what the\n> \"... are often removed or replaced\" part is talking about.\n\n\n>\n>\n>\n>\n"},{"id":"187935","messageId":"7v7gy4yd0w.fsf@alter.siamese.dyndns.org","threadId":"30075","inReplyTo":"BLU0-SMTP479C08A291DA7BEA81F1875B14B0@phx.gbl","subject":"Re: Working directory managment","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-28T15:13:19Z","receivedAt":"2012-03-28T15:13:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Anjib Mulepati <anjibcs@hotmail.com> writes:\n\n> What does it mean by this \" Files in this directory are often removed\n> or replaced by Git as you switch branches\"?\n\nDon't you already have an answer from me in the message you are responding\nto, which you quoted but perhaps you didn't read?\n"},{"id":"187939","messageId":"BLU0-SMTP194A55718CFB9375EA9D7BBB14B0@phx.gbl","threadId":"30075","inReplyTo":"7v7gy4yd0w.fsf@alter.siamese.dyndns.org","subject":"Re: Working directory managment","fromName":"Anjib Mulepati","fromEmail":"anjibcs@hotmail.com","sentAt":"2012-03-28T15:39:39Z","receivedAt":"2012-03-28T15:39:39Z","isPatch":false,"sender":{"key":"anjibcs@hotmail.com","avatar":"https://gravatar.com/avatar/7ac86efaee717c505c8eaabde7f28e645eae076024b9761dc426b6b77ff4f2a0?d=mp&s=160"},"body":"I am sorry if I haven't put my follow up question in proper place. It \nwas on top. My question was\n\nSo these removed or replaced is done automatically or as I understood we \ndo merge and and see conflict and do changes as per necessary?\n\ni don't want to waste someone precious time but I am reading book and \nsearching my own in internet to clear my confusion. That is not clear \nall time so that's why I am using this forum. I am reading all replies \nand trying to get basic concept as I go.\n\nThanks All\nAnjib\n\n\nOn 3/28/2012 11:13 AM, Junio C Hamano wrote:\n> Anjib Mulepati<anjibcs@hotmail.com>  writes:\n>\n>> What does it mean by this \" Files in this directory are often removed\n>> or replaced by Git as you switch branches\"?\n> Don't you already have an answer from me in the message you are responding\n> to, which you quoted but perhaps you didn't read?\n>\n>\n>\n"},{"id":"187940","messageId":"7v398sybpw.fsf@alter.siamese.dyndns.org","threadId":"30075","inReplyTo":"BLU0-SMTP479C08A291DA7BEA81F1875B14B0@phx.gbl","subject":"Re: Working directory managment","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-28T15:41:31Z","receivedAt":"2012-03-28T15:41:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Anjib Mulepati <anjibcs@hotmail.com> writes:\n\n> I was reading Git Community Book and came across following definition\n> for working directory\n>\n> The Working Directory\n>\n> The Git 'working directory' is the directory that holds the current\n> checkout of the files you are working on. Files in this directory are\n> often removed or replaced by Git as you switch branches - this is\n> normal. All your history is stored in the Git Directory; the working\n> directory is simply a temporary checkout place where you can modify\n> the files until your next commit.\n>\n> What does it mean by this \" Files in this directory are often removed\n> or replaced by Git as you switch branches\"?\n>\n>> I think the common terminology for the concept the above describes is \"the\n>> working tree\".\n>>\n>>> And does working directory is just a directory we get with $pwd ?\n>> After you clone, you have one directory that contains all the files from\n>> one specific version in it.  The files may be organized into directory\n>> hierarchy, but there is a single top-level directory.\n>>\n>> That is the \"working tree\".  When we want to be absolutely clear, we may\n>> even say \"the top of the working tree\", even though it may be redundant.\n>>\n>> If you are at such a directory, $(pwd) may match it.  If you chdir to a\n>> subdirectory from there, e.g. \"cd Documentation\", $(pwd) and the top of\n>> the working tree will of course disagree.\n>>\n>> The files checked out in the working tree represent the contents of the\n>> version that was checked out, plus modifications you make locally.  When\n>> you check out a different branch (people coming from svn background may\n>> say \"switch branch\", but it is the same thing), the working tree will need\n>> to represent the contents of the version at the tip of that different\n>> branch.  If you have a file in the current branch but not in that\n>> different branch you are checking out, that file has to go away.  If you\n>> do not have a file in the current branch but not in that different branch\n>> you are checking out, that file needs to be created in the working tree.\n>> If the contents of a file is different between your current branch and the\n>> branch you are checking out, the file in the working tree needs to be\n>> updated to match that of the branch you are checking out. That is what the\n>> \"... are often removed or replaced\" part is talking about.\n>\n> So these removed or replaced is done automatically or as I understood\n> we do merge and and see conflict and do changes as per necessary?\n\nAhhh.\n\nHere is one lesson for you to learn first: \"Do not top post\".  Your\ntop-posting made me miss the new questions on these two lines.  In the\nabove quote, I rearranged them to be the bottom.\n\nBy default, we do not attempt the content level merges, as that can let\nyou screw up your merge and allow you to lose your work in progress, when\nyou check out another branch.  We do however run tree level merges, so\nyou will carry your local uncommitted changes in the working tree with you\nwhen you check out a different branch.\n\nWhen you are just starting, make it a habit to commit the work-in-progress\nchanges you made for the current branch, even if they are not complete,\nbefore checking out another branch. You do not have to worry about what\nwould happen to the uncommitted changes that way. When you check out the\nbranch you left again, you \"reset HEAD^\" to drop the WIP commit and come\nback to the state you had.  E.g.\n\n\t$ git checkout -b xyzzy master\n        $ edit xyzzy.py ;# new file\n        $ git add xyzzy.py\n        $ git commit -m 'start working on xyzzy feature'\n        $ edit xyzzy.py ;# work more\n        ... you got bored and want to work on something else ...\n        $ git commit -a -m 'WIP'\n\n        $ git checkout -b frotz master\n\t... at this point, xyzzy.py is removed from the working tree,\n        ... as it did not exist in 'master' hence not in 'frotz'.\n\t$ edit ... ;# do whatever\n        $ git commit -a -m 'done with frotz feature'\n\n        $ git checkout xyzzy ;# back on xyzzy branch\n\t... working tree matches what is in the WIP commit\n\t$ git reset HEAD^\n        ... working tree remains the same, no more WIP commit\n\t$ edit xyzzy.py ;# continue from where you left off\n\nTry this while you have \"gitk\" open and see what is happening by observing\nits history display (you would have to refresh it) after \"git commit\",\n\"git checkout\", and \"git reset\".\n"},{"id":"187951","messageId":"CAH-tXsDp2_HuG9cOs7qfc3Gy-bmu_MNAJWDu4W_yLQtfCnGDSg@mail.gmail.com","threadId":"30075","inReplyTo":"BLU0-SMTP194A55718CFB9375EA9D7BBB14B0@phx.gbl","subject":"Re: Working directory managment","fromName":"jaseem abid","fromEmail":"jaseemabid@gmail.com","sentAt":"2012-03-28T16:31:19Z","receivedAt":"2012-03-28T16:31:19Z","isPatch":false,"sender":{"key":"jaseemabid@gmail.com","avatar":"https://gravatar.com/avatar/8b0432c96e4d3c8a9a96c9961ee842df7b7a869744da9c25187a51a992eabd81?d=mp&s=160"},"body":"On Wed, Mar 28, 2012 at 9:09 PM, Anjib Mulepati <anjibcs@hotmail.com> wrote:\n> I am sorry if I haven't put my follow up question in proper place. It was on\n> top. My question was...\n\nWith due respect, for simple problems like this the #git IRC channel\non freenode.net is the best place to get answers quick.  Most of the\ntime you get a solution in a matter of seconds.\n\n-- \nJaseem Abid\n+91 8891 72 43 72\nS6 CSE student\nNational Institute of Technology , Calicut.\n"}]}