Sourcetree and Visual Studio 2015

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

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

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.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

832 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you