Re: working directory status
- From
- Sivanandan Srilakshmanan <ssrilaks@gmail.com>
- Date
- Nov 18, 2019, 10:40 UTC
- Message-ID
- <CACKP9ct0AJE94=C32QEH_uD8S8PdGoFeW15oftcf-wifh6hWLA@mail.gmail.com>
- In-Reply-To
- <xmqqk17x1wvx.fsf@gitster-ct.c.googlers.com>
Hi Hannes, Junio, Eric & Pratyush
Thank you very much for your support. I greatly appreciate your guidance.
It is clear now and it is working well. It is possible to use a local bare repository as a conduit to manage multiple remote repositories.
I had to re-read the https://git-scm.com/docs keeping in mind the guidance given, to get a better handle on it.
For the benefit of anyone else stumbling across this thread.
As mentioned earlier **** DON'T *** set GIR_DIR and GIT_WORK_TREE.
Step 1. create a git repo (bare/non-bare) Step 2. git worktree add --track -b Local_Newfeature_branch1 Local_Newfeature remotes/Lakshman/feature_branch
The above will create a local branch Local_Newfeature_branch1 The above command will also checkout the code into the directory Local_Newfeature.
You can perform all your git command inside the directory Local_Newfeature.
C:\test\Local_Newfeature>git branch Local_Newfeature_branch * Local_Newfeature_branch1 Local_feature_branch
C:\test\Local_Newfeature>git worktree list C:/GitRepo (bare) C:/test/Local_Newfeature b0a097e [Local_Newfeature_branch1]
Works like a charm. Thank you all very, very very much for your guidance and feedback much appreciated.
Thanks Lakshman
On Mon, Nov 18, 2019 at 6:12 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 37 quoted lines
> > Johannes Sixt <j6t@kdbg.org> writes: > > > ... > > Do not set GIT_DIR if you do not understand the consequences. > > I think the explanation in your earlier message was probably a bit > more helpful. If they want to use GIT_DIR, they need to also set > and export GIT_WORK_TREE. > > Of course, with both exported, asking "git branch" for which branch > is checked out would ask about the working tree that GIT_WORK_TREE > points at without consulting $(pwd), so it is rather pointless. > When the user switches to another worktree, both GIT_DIR and > GIT_WORK_TREE need to be updated to point at appropriate places, so > it sort of defeats the purpose. > > > > >> 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] > > > > I do not know whether it is a sane use-case to have a bare repository > > and separate worktrees. > > > > Do not do that. Make a regular clone with a worktree and create > > secondary worktrees from there. > > As long as GIT_DIR/GIT_WORK_TREE are both set and exported (or both > unset, a new worktree made out of a bare clone should work just > fine. At least that is one of the use case I recall the feature was > designed to be used in. > > Thanks. >