'how move specific files (already pushed changes) from one branch to a new branch in android studio?
I am currently working on my android application on android studio and I am fairly new to working on it with git. I have files that I want to move from a branch (branch1) to a completely new branch (feature1). Please note that I have committed all of my changes to branch1 and I have pushed all of those commits as well.
I have seen similar questions with answers but I am quite confused about how to make it work. How can I do that? Thank you and pls bear with me :)
Solution 1:[1]
Let's say we have three branch in a repository (master, branch1, branch2).
Now, you want to remove file from branch1 and that file should be present in a completely new branch say branch3
Create new branch of
branch1git checkout branch1//to create new branch from branch1, you need to checkout to that branch firstgit checkout -b branch3
Now, the new files are in branch3.
Now checkout to branch1 and $ git rm <file-name> and $ git commit -m "file removed from branch"
It's the simple and straightforward way I can think of.
Solution 2:[2]
You can cherry pick commit that you want to move from branch1 to feature1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Paul Bradbury |
| Solution 2 | thaovd1712 |
