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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,677
Community Members
 
Community Events
176
Community Groups

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
TAGS

Atlassian Community Events