0

I created a Visual Studio .net core 3.1 project with visual studio 2019 and Azure Devops. I cloned the ripo master in :

d:\myprojects\myclient\mysolution I created a [bench] branch

Now, I would like to have 2 local folders :

d:\myprojects\myclient\mysolution\master

d:\myprojects\myclient\mysolution\bench

so I can create two web application endpoints.

Is it possible ?

Thanks

  • Does this answer your question? [GIT: Checkout to a specific folder](https://stackoverflow.com/questions/4479960/git-checkout-to-a-specific-folder) – Shayki Abramczyk Jul 29 '20 at 08:39
  • Hi Laurent, not get your latest information, is the answer below helpful for you? Or if you have any concern, feel free to share it here – Vito Liu Aug 03 '20 at 09:45

1 Answers1

0

For a git repository, it's possible to checkout branches into separate folders. In your case, d:\myprojects\myclient\mysolution is the main working tree with master checked out. You can checkout bench into another working tree,

git worktree add <path_to_bench_worktree> bench

path_to_bench_worktree could be any valid path, for example d:\myprojects\myclient\mysolution_bench.

The 2 working trees share the same git folder, d:\myprojects\myclient\mysolution\.git. You can modify files and commit changes in both working trees, one for master and the other for bench. You can create more working trees when necessary.

When you think a working tree is not needed any more, you can remove it,

# in the main working tree
git worktree remove <path_to_bench_worktree>

You can also remove path_to_bench_worktree first and then in the main working tree,

git worktree prune
ElpieKay
  • 22,398
  • 5
  • 27
  • 44
  • I think I would have : d:\myprojects\myclient\mysolution\master d:\myprojects\myclient\mysolution\bench d:\myprojects\myclient\mysolution\prod master is the latest version bench the pre prod version prod the current production version So, first I need to move d:\myprojects\myclient\mysolution to d:\myprojects\myclient\mysolution\master – Laurent Perso Jul 29 '20 at 09:46
  • Hi Laurent, This answer can download different branches code and save the code in the local file, if you have any follow questions, could you please describe your thoughts and problems in more detail? We will check it and help you. If the answer could give you some help, we can [accept it as answer](https://stackoverflow.com/help/someone-answers). – Vito Liu Jul 30 '20 at 09:45
  • With TFS, when I want to merge code from one branch to another, I first get the latest version of the target code and then I merge the source code into the cilble. The system indicates conflicts. We solve them, we compile and if it works, we check in the target branch. I can't seem to do the same with GIT – Laurent Perso Aug 07 '20 at 20:15