{"thread":{"id":"52280","subject":"working directory status","startedAt":"2019-11-17T00:55:25Z","lastAt":"2019-11-18T10:40:38Z","messageCount":11,"participants":["Sivanandan Srilakshmanan","Pratyush Yadav","Johannes Sixt","Eric Sunshine","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"386384","messageId":"CACKP9ctDPFn_oqHVSO9Lfi2aMDkAtiuViCv6PvYtmag+P+oaLQ@mail.gmail.com","threadId":"52280","inReplyTo":null,"subject":"working directory status","fromName":"Sivanandan Srilakshmanan","fromEmail":"ssrilaks@gmail.com","sentAt":"2019-11-17T00:55:09Z","receivedAt":"2019-11-17T00:55:25Z","isPatch":false,"sender":{"key":"ssrilaks@gmail.com","avatar":null},"body":"Hi,\n\nI am new to git. I have been reading the documentation on Pro Git.\n\nI have checked out two working directory (test1 & test2) using the\n\"git worktree add --checkout\" command.\n\nWhen I run the \"git status\" in either (test1 or test2) on the checked\nout folder, the \"On branch <branch name>\" displays the branch name\nfrom the latest checkout (ie branch associated with  test2).\n\nCould you please provide the correct syntax to display the branch name\nassociated with the respective folder.\n\nAny assistance is greatly appreciated.\n\nThanks\nLakshman\n"},{"id":"386388","messageId":"20191117072942.cycm2kyvt2g2bhaz@yadavpratyush.com","threadId":"52280","inReplyTo":"CACKP9ctDPFn_oqHVSO9Lfi2aMDkAtiuViCv6PvYtmag+P+oaLQ@mail.gmail.com","subject":"Re: working directory status","fromName":"Pratyush Yadav","fromEmail":"me@yadavpratyush.com","sentAt":"2019-11-17T07:29:42Z","receivedAt":"2019-11-17T07:29:46Z","isPatch":false,"sender":{"key":"me@yadavpratyush.com","avatar":"https://avatars.githubusercontent.com/u/8817931?v=4"},"body":"On 17/11/19 11:55AM, Sivanandan Srilakshmanan wrote:\n> Hi,\n> \n> I am new to git. I have been reading the documentation on Pro Git.\n> \n> I have checked out two working directory (test1 & test2) using the\n> \"git worktree add --checkout\" command.\n> \n> When I run the \"git status\" in either (test1 or test2) on the checked\n> out folder, the \"On branch <branch name>\" displays the branch name\n> from the latest checkout (ie branch associated with  test2).\n\nThis behaviour does not happen for me on Git v2.24.0. When I create \nmultiple worktrees, 'git status' in each worktree directory shows the \ncorrect branch. What version of Git are you using?\n \n> Could you please provide the correct syntax to display the branch name\n> associated with the respective folder.\n\nYou can use 'git worktree list' to see a list of all the worktrees. The \noutput of the list has 3 columns: path to the worktree, commit checked \nout, and the name of the branch checked out in that worktree.\n\nExample output:\n\n  $ git worktree list\n  /home/pratyush/src/git  50b2267a2a [next]\n  /home/pratyush/src/foo  50b2267a2a [foo]\n\nThe first worktree is in ~/src/git and has the branch 'next' checked \nout. The second is in ~/src/foo and has the branch 'foo' checked out.\n\nThat said, running 'git status' should still show you the correct branch \nname. Try updating Git to the latest version (v2.24.0), and try again.\n\n-- \nRegards,\nPratyush Yadav\n"},{"id":"386391","messageId":"CACKP9cs+eJMtwWJtc3c_TXOUacpaxHUP4Ugw5oSpDfKcABaR7g@mail.gmail.com","threadId":"52280","inReplyTo":"20191117072942.cycm2kyvt2g2bhaz@yadavpratyush.com","subject":"Re: working directory status","fromName":"Sivanandan Srilakshmanan","fromEmail":"ssrilaks@gmail.com","sentAt":"2019-11-17T11:07:45Z","receivedAt":"2019-11-17T11:08:00Z","isPatch":false,"sender":{"key":"ssrilaks@gmail.com","avatar":null},"body":"Hi Pratyush,\n\nThank you so so so very much for responding quickly. I am learning git\nto assist my teams skill up on git.\n\nMy current version is v2.23.0 which I downloaded and installed a month\nago. Nevertheless, I have downloaded and installed v2.24.0 and the\nproblem still persists.\n\nI have the following environment variable set\nGIT_DIR=C:\\GitRepo\nGIT_HOME=C:\\tools\\Git\n\nPlease find below output from my command.\n\nC:\\test\\Local_Newfeature>git branch\n* Local_Kumfeature_branch\n  Local_MyTest_branch\n+ Local_Newfeature_branch\n+ Local_SGSfeature_branch\n  Local_feature_branch\n\n\nC:\\test\\Local_Newfeature>git worktree list\nC:\\GitRepo                (bare)\nC:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\nC:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\nC:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n\n\n\nC:\\test\\Local_Newfeature>git --work-tree=C:\\test\\Local_Newfeature status\nOn branch Local_Kumfeature_branch\nYour branch is up to date with 'Lakshman/feature_branch'.\n\nnothing to commit, working tree clean\n\n\nYour assistance is greatly appreciated.\n\nThanks\nLakshman\n\n\nOn Sun, Nov 17, 2019 at 6:29 PM Pratyush Yadav <me@yadavpratyush.com> wrote:\n>\n> On 17/11/19 11:55AM, Sivanandan Srilakshmanan wrote:\n> > Hi,\n> >\n> > I am new to git. I have been reading the documentation on Pro Git.\n> >\n> > I have checked out two working directory (test1 & test2) using the\n> > \"git worktree add --checkout\" command.\n> >\n> > When I run the \"git status\" in either (test1 or test2) on the checked\n> > out folder, the \"On branch <branch name>\" displays the branch name\n> > from the latest checkout (ie branch associated with  test2).\n>\n> This behaviour does not happen for me on Git v2.24.0. When I create\n> multiple worktrees, 'git status' in each worktree directory shows the\n> correct branch. What version of Git are you using?\n>\n> > Could you please provide the correct syntax to display the branch name\n> > associated with the respective folder.\n>\n> You can use 'git worktree list' to see a list of all the worktrees. The\n> output of the list has 3 columns: path to the worktree, commit checked\n> out, and the name of the branch checked out in that worktree.\n>\n> Example output:\n>\n>   $ git worktree list\n>   /home/pratyush/src/git  50b2267a2a [next]\n>   /home/pratyush/src/foo  50b2267a2a [foo]\n>\n> The first worktree is in ~/src/git and has the branch 'next' checked\n> out. The second is in ~/src/foo and has the branch 'foo' checked out.\n>\n> That said, running 'git status' should still show you the correct branch\n> name. Try updating Git to the latest version (v2.24.0), and try again.\n>\n> --\n> Regards,\n> Pratyush Yadav\n"},{"id":"386393","messageId":"e5f25791-694d-6b5c-138b-ac99b4f50b13@kdbg.org","threadId":"52280","inReplyTo":"CACKP9cs+eJMtwWJtc3c_TXOUacpaxHUP4Ugw5oSpDfKcABaR7g@mail.gmail.com","subject":"Re: working directory status","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-11-17T12:30:28Z","receivedAt":"2019-11-17T12:30:33Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 17.11.19 um 12:07 schrieb Sivanandan Srilakshmanan:\n> Hi Pratyush,\n> \n> Thank you so so so very much for responding quickly. I am learning git\n> to assist my teams skill up on git.\n> \n> My current version is v2.23.0 which I downloaded and installed a month\n> ago. Nevertheless, I have downloaded and installed v2.24.0 and the\n> problem still persists.\n> \n> I have the following environment variable set\n> GIT_DIR=C:\\GitRepo\n> GIT_HOME=C:\\tools\\Git\n\nSetting GIT_DIR without also setting GIT_WORKTREE is not a supported\nuse-case. Therefore, ...\n\n> C:\\test\\Local_Newfeature>git branch\n> * Local_Kumfeature_branch\n>   Local_MyTest_branch\n> + Local_Newfeature_branch\n> + Local_SGSfeature_branch\n>   Local_feature_branch\n> \n> \n> C:\\test\\Local_Newfeature>git worktree list\n> C:\\GitRepo                (bare)\n> C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\n> C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\n> C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n\n... this does not work as expected, ....\n\n> C:\\test\\Local_Newfeature>git --work-tree=C:\\test\\Local_Newfeature status\n> On branch Local_Kumfeature_branch\n> Your branch is up to date with 'Lakshman/feature_branch'.\n> \n> nothing to commit, working tree clean\n\n... but this works (--work-tree is the same as setting GIT_WORKTREE).\n\nNobody sets GIT_DIR during normal day-to-day work. Do not set it unless\nyou know what you are doing.\n\n-- Hannes\n"},{"id":"386398","messageId":"CACKP9cv=J=_sDUsLZi7-GerFD=qbHuJT0MBdfgsMsN4pD25L2A@mail.gmail.com","threadId":"52280","inReplyTo":"e5f25791-694d-6b5c-138b-ac99b4f50b13@kdbg.org","subject":"Re: working directory status","fromName":"Sivanandan Srilakshmanan","fromEmail":"ssrilaks@gmail.com","sentAt":"2019-11-17T20:33:29Z","receivedAt":"2019-11-17T20:33:42Z","isPatch":false,"sender":{"key":"ssrilaks@gmail.com","avatar":null},"body":"Hi Hannes,\n\nThank you for taking the time to guide me.\n\nReading git documentation, my understanding is that, if you needed to\nuse \"git worktree add\" then it is recommended to keep your work tree\n(Working Dir) outside of your repository.\nMy understanding, please correct me if I am wrong, is to have multiple\nworktree outside of the Git Repository.\n\nif you used \"git clone\" to setup your directory and your worktree is\nincluded in the same location as the Git Repository, then GIT_DIR is\nnot required.\n\nPlease assist me to understand what I am doing incorrectly. The\n\"output 1\" below is incorrect because Local_Newfeature (working\ndirectory / worktree) is associated with the incorrect branch\n(Local_Kumfeature_branch)\nLocal_Newfeature directory should be pointing to \"Local_Newfeature_branch\".\n\nOutput 2 is correct.\n\n====== Output 1 - incorrect =========================================\nC:\\test\\Local_Newfeature>git --work-tree=C:\\test\\Local_Newfeature status\nOn branch Local_Kumfeature_branch\nYour branch is up to date with 'Lakshman/feature_branch'.\n\nnothing to commit, working tree clean\n\n\n===== Output 2  - correct =============================================\nC:\\test\\Local_Newfeature>git branch\n* Local_Kumfeature_branch\n  Local_MyTest_branch\n+ Local_Newfeature_branch\n+ Local_SGSfeature_branch\n  Local_feature_branch\n\n\nC:\\test\\Local_Newfeature>git worktree list\nC:\\GitRepo                (bare)\nC:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\nC:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\nC:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n\nThank you for your assistance and guidance in advance.\n\nLakshman\n\nOn Sun, Nov 17, 2019 at 11:30 PM Johannes Sixt <j6t@kdbg.org> wrote:\n>\n> Am 17.11.19 um 12:07 schrieb Sivanandan Srilakshmanan:\n> > Hi Pratyush,\n> >\n> > Thank you so so so very much for responding quickly. I am learning git\n> > to assist my teams skill up on git.\n> >\n> > My current version is v2.23.0 which I downloaded and installed a month\n> > ago. Nevertheless, I have downloaded and installed v2.24.0 and the\n> > problem still persists.\n> >\n> > I have the following environment variable set\n> > GIT_DIR=C:\\GitRepo\n> > GIT_HOME=C:\\tools\\Git\n>\n> Setting GIT_DIR without also setting GIT_WORKTREE is not a supported\n> use-case. Therefore, ...\n>\n> > C:\\test\\Local_Newfeature>git branch\n> > * Local_Kumfeature_branch\n> >   Local_MyTest_branch\n> > + Local_Newfeature_branch\n> > + Local_SGSfeature_branch\n> >   Local_feature_branch\n> >\n> >\n> > C:\\test\\Local_Newfeature>git worktree list\n> > C:\\GitRepo                (bare)\n> > C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\n> > C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\n> > C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n>\n> ... this does not work as expected, ....\n>\n> > C:\\test\\Local_Newfeature>git --work-tree=C:\\test\\Local_Newfeature status\n> > On branch Local_Kumfeature_branch\n> > Your branch is up to date with 'Lakshman/feature_branch'.\n> >\n> > nothing to commit, working tree clean\n>\n> ... but this works (--work-tree is the same as setting GIT_WORKTREE).\n>\n> Nobody sets GIT_DIR during normal day-to-day work. Do not set it unless\n> you know what you are doing.\n>\n> -- Hannes\n"},{"id":"386422","messageId":"6bb36048-6649-ebe3-062f-c5564f7d4ec4@kdbg.org","threadId":"52280","inReplyTo":"CACKP9cv=J=_sDUsLZi7-GerFD=qbHuJT0MBdfgsMsN4pD25L2A@mail.gmail.com","subject":"Re: working directory status","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-11-17T22:26:14Z","receivedAt":"2019-11-17T22:26:19Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 17.11.19 um 21:33 schrieb Sivanandan Srilakshmanan:\n> Reading git documentation, my understanding is that, if you needed to\n> use \"git worktree add\" then it is recommended to keep your work tree\n> (Working Dir) outside of your repository.\n> My understanding, please correct me if I am wrong, is to have multiple\n> worktree outside of the Git Repository.\n\nThat sounds reasonable. Note though that if you need N worktrees, then\nyou have one worktree with the (non-bare) repository, and N-1 worktrees\noutside that repository.\n\n> if you used \"git clone\" to setup your directory and your worktree is\n> included in the same location as the Git Repository, then GIT_DIR is\n> not required.\n\nYes.\n\n> Please assist me to understand what I am doing incorrectly. The\n> \"output 1\" below is incorrect because Local_Newfeature (working\n> directory / worktree) is associated with the incorrect branch\n> (Local_Kumfeature_branch)\n> Local_Newfeature directory should be pointing to \"Local_Newfeature_branch\".\n> \n> Output 2 is correct.\n> \n> ====== Output 1 - incorrect =========================================\n> C:\\test\\Local_Newfeature>git --work-tree=C:\\test\\Local_Newfeature status\n> On branch Local_Kumfeature_branch\n> Your branch is up to date with 'Lakshman/feature_branch'.\n\nYou observe this incorrect output because you have GIT_DIR set.\nObvously, Git looks at the branch that the HEAD of $GIT_DIR refers to.\n\nDo not set GIT_DIR if you do not know what it is good for.\n\n> ===== Output 2  - correct =============================================\n> C:\\test\\Local_Newfeature>git branch\n> * Local_Kumfeature_branch\n>   Local_MyTest_branch\n> + Local_Newfeature_branch\n> + Local_SGSfeature_branch\n>   Local_feature_branch\n\nIf Output 1 is incorrect, this is not correct, either: Note that\nLocal_Kumfeature_branch is marked as the branch for this directory, but\nyou intend it to be Local_Newfeature_branch, yet it is marked as living\nin a different worktree.\n\nDo not set GIT_DIR if you do not understand the consequences.\n\n> C:\\test\\Local_Newfeature>git worktree list\n> C:\\GitRepo                (bare)\n> C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\n> C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\n> C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n\nI do not know whether it is a sane use-case to have a bare repository\nand separate worktrees.\n\nDo not do that. Make a regular clone with a worktree and create\nsecondary worktrees from there.\n\n-- Hannes\n"},{"id":"386436","messageId":"CACKP9csUwnYJFL55KSMmys+o7FC5Wzds_2kbCcYNESiL-SES1A@mail.gmail.com","threadId":"52280","inReplyTo":"6bb36048-6649-ebe3-062f-c5564f7d4ec4@kdbg.org","subject":"Re: working directory status","fromName":"Sivanandan Srilakshmanan","fromEmail":"ssrilaks@gmail.com","sentAt":"2019-11-18T04:32:32Z","receivedAt":"2019-11-18T04:32:46Z","isPatch":false,"sender":{"key":"ssrilaks@gmail.com","avatar":null},"body":"Hi Hannes,\n\nThank you so very very, very much for your guidance.\n\nMy team and I maintain multiple projects, each with it's own remotely\nhosted git repository.\n\nI was reluctant to create clones of each project on my local machine\neach with it's own \"main working tree\"\n\nI figured:-\n\nI could setup a \"Local bare repository\" and create remote link to the\nhosted git repositories.\n(https://git-scm.com/docs/git-worktree#_list_output_format)\n\nCreate \"Local branches\" when needed. Create a \"linked working tree\"\nassociated with the local branch.\n\nClean up the linked working tree when work is complete.\n\n\n\nThis way I can have a single repository pointing to multiple remote\nrepositories on one side and managing multiple local directories on my\nPC.\nIn summary, my local repository will be conduit. I guess this is not possible.\n\nBased on my requirement would you suggest the best approach would be\nto create git clone for each remote repository?\n\nThanks again for your help and guidance.\n\nThanks\nLakshman\n\nOn Mon, Nov 18, 2019 at 9:26 AM Johannes Sixt <j6t@kdbg.org> wrote:\n>\n> Am 17.11.19 um 21:33 schrieb Sivanandan Srilakshmanan:\n> > Reading git documentation, my understanding is that, if you needed to\n> > use \"git worktree add\" then it is recommended to keep your work tree\n> > (Working Dir) outside of your repository.\n> > My understanding, please correct me if I am wrong, is to have multiple\n> > worktree outside of the Git Repository.\n>\n> That sounds reasonable. Note though that if you need N worktrees, then\n> you have one worktree with the (non-bare) repository, and N-1 worktrees\n> outside that repository.\n>\n> > if you used \"git clone\" to setup your directory and your worktree is\n> > included in the same location as the Git Repository, then GIT_DIR is\n> > not required.\n>\n> Yes.\n>\n> > Please assist me to understand what I am doing incorrectly. The\n> > \"output 1\" below is incorrect because Local_Newfeature (working\n> > directory / worktree) is associated with the incorrect branch\n> > (Local_Kumfeature_branch)\n> > Local_Newfeature directory should be pointing to \"Local_Newfeature_branch\".\n> >\n> > Output 2 is correct.\n> >\n> > ====== Output 1 - incorrect =========================================\n> > C:\\test\\Local_Newfeature>git --work-tree=C:\\test\\Local_Newfeature status\n> > On branch Local_Kumfeature_branch\n> > Your branch is up to date with 'Lakshman/feature_branch'.\n>\n> You observe this incorrect output because you have GIT_DIR set.\n> Obvously, Git looks at the branch that the HEAD of $GIT_DIR refers to.\n>\n> Do not set GIT_DIR if you do not know what it is good for.\n>\n> > ===== Output 2  - correct =============================================\n> > C:\\test\\Local_Newfeature>git branch\n> > * Local_Kumfeature_branch\n> >   Local_MyTest_branch\n> > + Local_Newfeature_branch\n> > + Local_SGSfeature_branch\n> >   Local_feature_branch\n>\n> If Output 1 is incorrect, this is not correct, either: Note that\n> Local_Kumfeature_branch is marked as the branch for this directory, but\n> you intend it to be Local_Newfeature_branch, yet it is marked as living\n> in a different worktree.\n>\n> Do not set GIT_DIR if you do not understand the consequences.\n>\n> > C:\\test\\Local_Newfeature>git worktree list\n> > C:\\GitRepo                (bare)\n> > C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\n> > C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\n> > C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n>\n> I do not know whether it is a sane use-case to have a bare repository\n> and separate worktrees.\n>\n> Do not do that. Make a regular clone with a worktree and create\n> secondary worktrees from there.\n>\n> -- Hannes\n"},{"id":"386439","messageId":"31883f6f-7b5a-a2aa-951d-51f9eee6f68d@kdbg.org","threadId":"52280","inReplyTo":"CACKP9csUwnYJFL55KSMmys+o7FC5Wzds_2kbCcYNESiL-SES1A@mail.gmail.com","subject":"Re: working directory status","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2019-11-18T06:51:39Z","receivedAt":"2019-11-18T06:51:45Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 18.11.19 um 05:32 schrieb Sivanandan Srilakshmanan:\n> Hi Hannes,\n> \n> Thank you so very very, very much for your guidance.\n> \n> My team and I maintain multiple projects, each with it's own remotely\n> hosted git repository.\n> \n> I was reluctant to create clones of each project on my local machine\n> each with it's own \"main working tree\"\n> \n> I figured:-\n> \n> I could setup a \"Local bare repository\" and create remote link to the\n> hosted git repositories.\n> (https://git-scm.com/docs/git-worktree#_list_output_format)\n> \n> Create \"Local branches\" when needed. Create a \"linked working tree\"\n> associated with the local branch.\n> \n> Clean up the linked working tree when work is complete.\n> \n> \n> \n> This way I can have a single repository pointing to multiple remote\n> repositories on one side and managing multiple local directories on my\n> PC.\n> In summary, my local repository will be conduit. I guess this is not possible.\n\nI think it is possible. Just don't make it a bare repository if you need\nto create secondary worktrees. (But maybe it even works if it is bare;\njust don't set GIT_DIR; I don't do it this way, so I cannot tell.)\n\n> Based on my requirement would you suggest the best approach would be\n> to create git clone for each remote repository?\n\nThat is probably easier.\n\n-- Hannes\n"},{"id":"386440","messageId":"CAPig+cTBnWyLVLJBpeFhmW3yOmgiCr0YT3aHQFBT=pXWcheRLw@mail.gmail.com","threadId":"52280","inReplyTo":"31883f6f-7b5a-a2aa-951d-51f9eee6f68d@kdbg.org","subject":"Re: working directory status","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2019-11-18T07:01:28Z","receivedAt":"2019-11-18T07:01:43Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, Nov 18, 2019 at 1:51 AM Johannes Sixt <j6t@kdbg.org> wrote:\n> Am 18.11.19 um 05:32 schrieb Sivanandan Srilakshmanan:\n> > I was reluctant to create clones of each project on my local machine\n> > each with it's own \"main working tree\"\n> >\n> > I figured:-\n> >\n> > I could setup a \"Local bare repository\" and create remote link to the\n> > hosted git repositories.\n> > (https://git-scm.com/docs/git-worktree#_list_output_format)\n> >\n> > Create \"Local branches\" when needed. Create a \"linked working tree\"\n> > associated with the local branch.\n> >\n> > This way I can have a single repository pointing to multiple remote\n> > repositories on one side and managing multiple local directories on my\n> > PC.\n> > In summary, my local repository will be conduit. I guess this is not possible.\n>\n> I think it is possible. Just don't make it a bare repository if you need\n> to create secondary worktrees. (But maybe it even works if it is bare;\n> just don't set GIT_DIR; I don't do it this way, so I cannot tell.)\n\ngit-worktree explicitly supports the use-case of the main worktree\nbeing bare. (Of course, in this case, it's a misnomer to call it the\n\"main _worktree_\", but the terminology was already established by the\ntime explicit support for bareness was added, so the term \"main\nworktree\" stuck.)\n"},{"id":"386441","messageId":"xmqqk17x1wvx.fsf@gitster-ct.c.googlers.com","threadId":"52280","inReplyTo":"6bb36048-6649-ebe3-062f-c5564f7d4ec4@kdbg.org","subject":"Re: working directory status","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-18T07:12:02Z","receivedAt":"2019-11-18T07:12:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> ...\n> Do not set GIT_DIR if you do not understand the consequences.\n\nI think the explanation in your earlier message was probably a bit\nmore helpful.  If they want to use GIT_DIR, they need to also set\nand export GIT_WORK_TREE.\n\nOf course, with both exported, asking \"git branch\" for which branch\nis checked out would ask about the working tree that GIT_WORK_TREE\npoints at without consulting $(pwd), so it is rather pointless.\nWhen the user switches to another worktree, both GIT_DIR and\nGIT_WORK_TREE need to be updated to point at appropriate places, so\nit sort of defeats the purpose.\n\n>\n>> C:\\test\\Local_Newfeature>git worktree list\n>> C:\\GitRepo                (bare)\n>> C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\n>> C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\n>> C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n>\n> I do not know whether it is a sane use-case to have a bare repository\n> and separate worktrees.\n>\n> Do not do that. Make a regular clone with a worktree and create\n> secondary worktrees from there.\n\nAs long as GIT_DIR/GIT_WORK_TREE are both set and exported (or both\nunset, a new worktree made out of a bare clone should work just\nfine.  At least that is one of the use case I recall the feature was\ndesigned to be used in.\n\nThanks.\n\n"},{"id":"386443","messageId":"CACKP9ct0AJE94=C32QEH_uD8S8PdGoFeW15oftcf-wifh6hWLA@mail.gmail.com","threadId":"52280","inReplyTo":"xmqqk17x1wvx.fsf@gitster-ct.c.googlers.com","subject":"Re: working directory status","fromName":"Sivanandan Srilakshmanan","fromEmail":"ssrilaks@gmail.com","sentAt":"2019-11-18T10:40:22Z","receivedAt":"2019-11-18T10:40:38Z","isPatch":false,"sender":{"key":"ssrilaks@gmail.com","avatar":null},"body":"Hi Hannes, Junio, Eric & Pratyush\n\nThank you very much for your support. I greatly appreciate your guidance.\n\nIt is clear now and it is working well. It is possible to use a local\nbare repository as a conduit to manage multiple remote repositories.\n\nI had to re-read the https://git-scm.com/docs keeping in mind the\nguidance given, to get a better handle on it.\n\nFor the benefit of anyone else stumbling across this thread.\n\nAs mentioned earlier ****  DON'T  ***  set GIR_DIR and GIT_WORK_TREE.\n\nStep 1. create a git repo (bare/non-bare)\nStep 2. git worktree add --track -b    Local_Newfeature_branch1\nLocal_Newfeature       remotes/Lakshman/feature_branch\n\nThe above will create a local branch Local_Newfeature_branch1\nThe above command will also checkout the code into  the directory\nLocal_Newfeature.\n\nYou can perform all your git command inside the directory Local_Newfeature.\n\nC:\\test\\Local_Newfeature>git branch\n  Local_Newfeature_branch\n* Local_Newfeature_branch1\n  Local_feature_branch\n\nC:\\test\\Local_Newfeature>git worktree list\nC:/GitRepo                (bare)\nC:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch1]\n\n\n\nWorks like a charm. Thank you all very, very very much for your\nguidance and feedback much appreciated.\n\nThanks\nLakshman\n\n\nOn Mon, Nov 18, 2019 at 6:12 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> Johannes Sixt <j6t@kdbg.org> writes:\n>\n> > ...\n> > Do not set GIT_DIR if you do not understand the consequences.\n>\n> I think the explanation in your earlier message was probably a bit\n> more helpful.  If they want to use GIT_DIR, they need to also set\n> and export GIT_WORK_TREE.\n>\n> Of course, with both exported, asking \"git branch\" for which branch\n> is checked out would ask about the working tree that GIT_WORK_TREE\n> points at without consulting $(pwd), so it is rather pointless.\n> When the user switches to another worktree, both GIT_DIR and\n> GIT_WORK_TREE need to be updated to point at appropriate places, so\n> it sort of defeats the purpose.\n>\n> >\n> >> C:\\test\\Local_Newfeature>git worktree list\n> >> C:\\GitRepo                (bare)\n> >> C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]\n> >> C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]\n> >> C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]\n> >\n> > I do not know whether it is a sane use-case to have a bare repository\n> > and separate worktrees.\n> >\n> > Do not do that. Make a regular clone with a worktree and create\n> > secondary worktrees from there.\n>\n> As long as GIT_DIR/GIT_WORK_TREE are both set and exported (or both\n> unset, a new worktree made out of a bare clone should work just\n> fine.  At least that is one of the use case I recall the feature was\n> designed to be used in.\n>\n> Thanks.\n>\n"}]}