Sourcetree and Visual Studio 2015

Ian Lienert November 28, 2017

My team has a repository of many C#/.NET projects coded in Visual Studio 2015 and we are trying to migrate our codebase from SVN to Git hosted on Bitbucket. One thing I'm struggling with after the migration is how to cleanly switch between tags using Sourcetree. The problem is that when I compile and run my application from master, many DLLs and other binaries are generated in my project folder. If I then checkout a new tag on Sourcetree (with "Clean (discard all changes)" selected), I can see all of my DLLs are still there and rebuilding and running the application can result in some weird behaviour that can only be explained by having the old DLLs in there.

Basically, my question is: is there a way to checkout a tag in Sourcetree truly cleanly so that the state of the repository is just as if I freshly checked out the repo from remote and then immediately switched to a new tag?

1 answer

1 vote
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 29, 2017

Hi Ian, afaik that's what should be happening. You might want to have a look at git clean, although this is a command that needs to be run in the command line, as it's not implemented in Sourcetree. You can read more about it at git-clean.

Hope that helps!

Ana

Ian Lienert November 29, 2017

Thanks Ana. I think the problem is that it is not git clean-ing my ignored files. Is there a way to force a clean of everything including ignored files? I think TortoiseGit handles this by passing -fx to the clean command. Not sure how this is done in Sourcetree.

Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 30, 2017

Hmmm, so you mean that you have ignored files that are still appearing? Keep in mind that if the files have already been tracked, .gitignore will not prevent them from being added. This means, if the files were tracked before, they will continue to be tracked, to stop tracking a file you need to remove it from the index, you can achieve this with the command:

git rm --cached <file>

The removal of the file from the head revision will happen on the next commit.

Let us know if that's what you meant :)

Cheers,

Ana

Like Ray Johnson likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events