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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


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

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
AUG Leaders

Atlassian Community Events