Re: working directory status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17/11/19 11:55AM, Sivanandan Srilakshmanan wrote:
> Hi,
> 
> I am new to git. I have been reading the documentation on Pro Git.
> 
> I have checked out two working directory (test1 & test2) using the
> "git worktree add --checkout" command.
> 
> When I run the "git status" in either (test1 or test2) on the checked
> out folder, the "On branch <branch name>" displays the branch name
> from the latest checkout (ie branch associated with  test2).

This behaviour does not happen for me on Git v2.24.0. When I create 
multiple worktrees, 'git status' in each worktree directory shows the 
correct branch. What version of Git are you using?
 
> Could you please provide the correct syntax to display the branch name
> associated with the respective folder.

You can use 'git worktree list' to see a list of all the worktrees. The 
output of the list has 3 columns: path to the worktree, commit checked 
out, and the name of the branch checked out in that worktree.

Example output:

  $ git worktree list
  /home/pratyush/src/git  50b2267a2a [next]
  /home/pratyush/src/foo  50b2267a2a [foo]

The first worktree is in ~/src/git and has the branch 'next' checked 
out. The second is in ~/src/foo and has the branch 'foo' checked out.

That said, running 'git status' should still show you the correct branch 
name. Try updating Git to the latest version (v2.24.0), and try again.

-- 
Regards,
Pratyush Yadav



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux