Sometimes a developer wants to change the old git repository url to New or remove git tracking history and push the code as a fresh new project.
To remove git from Android Studio Project, we need to follow two steps:
- Removing the .git hidden folder
- Removing git path from Version Control
Step 1: Removing the .git hidden folder
If we skip this step, our git tracking history is still not deleted. Now when we re-enable VCS, Our project binds with the older repository.
We can remove the .git folder by going to the project repository folder and deleting the .git hidden folder Or
Also, we can use Command-line in Android Studio Terminal:
Windows: rd /s /q “.git”
Linux/Mac: rm -rf .git
By doing this step, we can still see the git section at the bottom of the Android Studio, And also you can manually check the git menu. There is no “Enable Version Control” option. So we need to do Step 2.
Step 2: Removing git path from Version Control
To remove Git binding from the Android Studio Project, you need to do the Following Steps:
Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
Click on Version Control
- Select project path
- Click ‘-’(minus button)
- Click Apply and Ok to save your changes
Now we can Enable Version Control and create a new git repository. Be sure to give claps if you find this article helpful.