I have a github repository which has a folder that i didnt mean to commit. I removed that folder from my local git repo, but when i push my local repo, all new changes are pushed, but the folder is still in my remote repository. how can i delete this folder from GITHUB?
Asked
Active
Viewed 1.0k times
4
-
How exactly did you remove that folder from your local repo? Did you commit the removal? – phd Jun 22 '20 at 00:16
-
yes, i committed the removal. I just deleted the folder, then pushed to my remote repo. But it's still there on github – Ebenezer Mathebula Jun 22 '20 at 00:31
-
1Delete and push is not enough. You must have committed: `git rm -rf folder && git commit && git push` – phd Jun 22 '20 at 00:41
-
Now when the folder is already deleted you still need to commit deletion so try `git commit -a && git push` – phd Jun 22 '20 at 00:43
-
1Also for the future, you can try adding such folders in the `.gitignore` file. – Rupesh Jun 22 '20 at 07:20
1 Answers
10
As commenters suggested, you can delete the folder as part of a commit using git rm
.
Specifically,
git checkout <branch name>
git pull
git rm -rf <folder name>
git commit -m "<commit message>"
git push origin <branch name>

Tyler James Young
- 130
- 11

yes-siz
- 348
- 2
- 9