Background (In a hurry? Skip this part.)Did you know that Android Studio, as of this writing, does not have Team Foundation Server integration? This has a wide variety of consequences:
- Every project file is read-only, and you need to unlock each manually
- You cannot checkin files from Android Studio
- New files are not automatically added to source control
- Files that need to be excluded from source control might get checked-in
One way to avoid these problems is to use a different source control for Android Studio projects until it supports TFS. But you may be required to use TFS for any number of different reasons. For example, I work for a company that uses TFS for source control and work items.
There's a way to use Git (which Android Studio fully supports) with TFS repositories.
Git-TF allows you to use Git to manipulate TFS repositories. This is great for situations where you're not working from an IDE with TFS integration but still need to use TFS.
There are two ways of installing Git-TF: manually and with Chocolatey. Both are easy, but be careful about using the Chocolatey install because it requires JRE 7 (and not 8) and overwrites some system settings that you may need.
You'll want to follow Git-TF's "Individual developer with a new repository" instructions because you will want to work with a new Git repository on your local machine.
Recommendation: Checkin .gitignore to TFS
TFS does not use .gitignore files, but I think that they should still be checked into TFS. Multiple members of your team may want to use Git-TF for a project, and including .gitignore makes it easy for them to jump-in without having to add their own .gitignore.
Be Careful About Directories
If you currently use Git and TFS, using Git-TF should be easy. But there's a catch that I've encountered: Git-TF does not work well when used within a directory mapped to TFS.
If the TFS repository root is mapped to C:\TFS, and your Git repository is in C:\TFS\AndroidStudioProject, you will encounter errors when trying to checkin or shelve changes. These errors are workspace-related and (as far as I know) can only be resolved by unmapping the directory or creating your Git repository in a different directory (such as C:\GitProjects).