Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I change the main working tree location without losing my files?

IBrown_BluePrint May 5, 2021

I'm looking to have the repository track files that are not in the same folder or subfolder as the `.git` folder by making the Main Working Tree a different folder. This is completely allowed in git and required for a use case of mine (the folder to be tracked is occasionally deleted and regenerated entirely by the IDE, which would delete the `.git` folder as well).

This is a loaded question; I'm miffed about a 3 year old Sourcetree for Windows bug (duplicate) that deletes files instead of staging them and it was just suggested to me it is not a bug, I'm just not doing it right. So what is the SourceTree approved way to change the location of the main working tree?

The way I have been doing it is to edit the repository config files to add:  
`worktree = C:\\Some\\Path` and git starts tracking that folder instead of the one containing the `.git` folder. This works fine when only using git via the terminal or alternate GUIs, but attempting to stage a file in SourceTree will delete it instead. Yes, staging a file you just worked on will delete it. Not just fail to stage it, it is gone. It isn't in the recycle bin, SourceTree deleted it just when you were hoping to save your changes to git.

So, if editing the repo config file isn't how you change the main working tree location in SourceTree, then how do you do it?

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events