git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: working directory status

From
SSSivanandan Srilakshmanan <ssrilaks@gmail.com>
Date
Nov 17, 2019, 20:33 UTC
Message-ID
<CACKP9cv=J=_sDUsLZi7-GerFD=qbHuJT0MBdfgsMsN4pD25L2A@mail.gmail.com>
In-Reply-To
<e5f25791-694d-6b5c-138b-ac99b4f50b13@kdbg.org>
Hi Hannes,
Thank you for taking the time to guide me.

Reading git documentation, my understanding is that, if you needed to use "git worktree add" then it is recommended to keep your work tree (Working Dir) outside of your repository. My understanding, please correct me if I am wrong, is to have multiple worktree outside of the Git Repository.

if you used "git clone" to setup your directory and your worktree is included in the same location as the Git Repository, then GIT_DIR is not required.

Please assist me to understand what I am doing incorrectly. The "output 1" below is incorrect because Local_Newfeature (working directory / worktree) is associated with the incorrect branch (Local_Kumfeature_branch) Local_Newfeature directory should be pointing to "Local_Newfeature_branch".

Output 2 is correct.

====== Output 1 - incorrect ========================================= C:\test\Local_Newfeature>git --work-tree=C:\test\Local_Newfeature status On branch Local_Kumfeature_branch Your branch is up to date with 'Lakshman/feature_branch'.

nothing to commit, working tree clean
===== Output 2  - correct =============================================
C:\test\Local_Newfeature>git branch
* Local_Kumfeature_branch
  Local_MyTest_branch
+ Local_Newfeature_branch
+ Local_SGSfeature_branch
  Local_feature_branch

C:\test\Local_Newfeature>git worktree list C:\GitRepo (bare) C:/test/Local_Kumfeature b0a097e [Local_Kumfeature_branch] C:/test/Local_Newfeature b0a097e [Local_Newfeature_branch] C:/test/Local_SGSfeature b0a097e [Local_SGSfeature_branch]

Thank you for your assistance and guidance in advance.
Lakshman
On Sun, Nov 17, 2019 at 11:30 PM Johannes Sixt <j6t@kdbg.org> wrote:
Show 46 quoted lines
>
> Am 17.11.19 um 12:07 schrieb Sivanandan Srilakshmanan:
> > Hi Pratyush,
> >
> > Thank you so so so very much for responding quickly. I am learning git
> > to assist my teams skill up on git.
> >
> > My current version is v2.23.0 which I downloaded and installed a month
> > ago. Nevertheless, I have downloaded and installed v2.24.0 and the
> > problem still persists.
> >
> > I have the following environment variable set
> > GIT_DIR=C:\GitRepo
> > GIT_HOME=C:\tools\Git
>
> Setting GIT_DIR without also setting GIT_WORKTREE is not a supported
> use-case. Therefore, ...
>
> > C:\test\Local_Newfeature>git branch
> > * Local_Kumfeature_branch
> >   Local_MyTest_branch
> > + Local_Newfeature_branch
> > + Local_SGSfeature_branch
> >   Local_feature_branch
> >
> >
> > C:\test\Local_Newfeature>git worktree list
> > C:\GitRepo                (bare)
> > C:/test/Local_Kumfeature  b0a097e [Local_Kumfeature_branch]
> > C:/test/Local_Newfeature  b0a097e [Local_Newfeature_branch]
> > C:/test/Local_SGSfeature  b0a097e [Local_SGSfeature_branch]
>
> ... this does not work as expected, ....
>
> > C:\test\Local_Newfeature>git --work-tree=C:\test\Local_Newfeature status
> > On branch Local_Kumfeature_branch
> > Your branch is up to date with 'Lakshman/feature_branch'.
> >
> > nothing to commit, working tree clean
>
> ... but this works (--work-tree is the same as setting GIT_WORKTREE).
>
> Nobody sets GIT_DIR during normal day-to-day work. Do not set it unless
> you know what you are doing.
>
> -- Hannes
Previous: Johannes SixtNext: Johannes Sixt
Message 5 of 11 in “working directory status”
  1. Sivanandan SrilakshmananNov 17, 2019
  2. Pratyush YadavNov 17, 2019
  3. Sivanandan SrilakshmananNov 17, 2019
  4. Johannes SixtNov 17, 2019
  5. Sivanandan SrilakshmananNov 17, 2019
  6. Johannes SixtNov 17, 2019
  7. Sivanandan SrilakshmananNov 18, 2019
  8. Johannes SixtNov 18, 2019
  9. Eric SunshineNov 18, 2019
  10. Junio C HamanoNov 18, 2019
  11. Sivanandan SrilakshmananNov 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.