Scenario:
I have an instrument test project, on master branch containing four tests.
Try to add two test: Create a new branch dev, add two tests.
Then later, we decide these two tests should be seperated into a new project
Solution:
- Push currrent dev branch to remote
-
cd
andmkdir
, create a new folder(Not directly clone since there is already one existing project directory) - In the new folder, execute:
git clone --single-branch --branch=dev repoUrl
Now I have a new project containing only this specific branch dev
- Rename
dev
tomaster
:
git branch -m dev master
- Create a new remote repository, and push master to the new repository
// Since this project is cloned from remote to local, there is already an existing remote repo
git remote set-url origin newRepoUrl
git push origin master
-
Rename project
- In android studio, open this new project
- In android studio top left, choose
Project
- In
app/src/androidTest/java/${projectName}
, right click, chooseRefactor - Rename
- In the new warning dialog, choose
Rename Project
File - Invalidate Caches / Restart
- In
app - build.gradle
, update applicationId
网友评论