I want a branch to hold all the files from my master branch except for foo.txt and foo2.txt. How do I do this?
Using git rm <deleted-filename> and git add <deleted-filename>. Your branch is up-to-date with 'origin/master'. It will stage the deleted file, and followed by git commit and git push will remove the file from the repository. Your branch is ahead of 'origin/master' by 1 commit.
The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.
Browse to the directory in your repository that you want to delete. In the top-right corner, click , then click Delete directory. Review the files you will delete. At the bottom of the page, type a short, meaningful commit message that describes the change you made to the file.
You have to branch off from master. Check out a new branch and remove the files you do not want.
git checkout master
Once in 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With