This tutorial explains how to use Git Version Control with Android Studio. Git is a distributed version control system. Git is a best choice among all the version control software like CVS, SVN etc.
Android studio comes with Git client. All we need to do is just enable and start using it. As a prerequisite, we need to have Git installed in local system.
To download Git use http://git-scm.com/downloads and install.
Here I am using Ubuntu 14.04 for example.
Install Git in Ubuntu
sudo apt-get install git
Once it is install, add this to the Android Studio intallation. Open the Android Studio and do the below mentioned steps-
‘File’ –> ‘Settings’ –> ‘Version Control’ –> ‘Git’.
Then click ‘Test’ to ensure that Git is configured properly in Android Studio.
Enable Version Control Integration
Before using Git or any other version control with an existing project, ‘Version Control Integration’ should be enabled.
In Android Studio, got to ‘VCS’ –> ‘Enable Version Control Integration’. This step is for an already existing project in Android Studio, that is not is integrated with any version control.
On enable, we will get a dialog window with options to choose like CVS, Git, Subversion and others. Now in this tutorial, we have take Git from the list.
On successful enable the options under VCS menu will change showing the Git options to add, commit, etc. The color of the files in Android Studio project explorer will change to brown from previous black. This indicates that the files are new and yet to be added to Git server.
Now you are ready to use Git.