-1

I have a two branches in my projects:

  • Main
  • Developper

I want to delete all the content (files and directories) of the Developper branch without deleting the branch from the repo.

  • Why did you not delete all the files and directories and add these changes to the staging area and make a new commit? – mkrieger1 Apr 17 '22 at 19:04
  • Does this answer your question? [Make the current commit the only (initial) commit in a Git repository?](https://stackoverflow.com/questions/9683279/make-the-current-commit-the-only-initial-commit-in-a-git-repository) – Arty-chan Apr 17 '22 at 19:15

2 Answers2

2

Make sure you are on the right branch and check to see it's status:

git branch
git status

Optionally commit anything you want to save.

If or when all is well, then delete everything:

rm -r *

And commit your work:

git add .
commit -m "deleting all content from branch"

check your status again and if everything seems right you can push your work:

git push

If necessary, you can force your delete:

rm -rf *
ccalvert
  • 3,816
  • 1
  • 23
  • 22
0

You can checkout onto the developper branch and manually delete all files and directories. Then commit these changes and push them. This will tell git to delete all files just from this branch.

Joshua Zeltser
  • 488
  • 2
  • 9