How to delete files from one and only one branch in git

I want the branch to contain all the files from my main branch except foo.txt and foo2.txt. How to do it?

+4
source share
1 answer

You need to separate from the master. Check out the new branch and delete the files you do not want.

git checkout master

Once the master:

git checkout -b new_branch

rm foo.txt
rm foo2.txt

git add -u
git commit -m "removed foo and foo2"
git push origin new_branch
+10
source

All Articles