Remove folder/file from GIT not from disc

Hi friends,

Today I faced a complex problem with my Bitbucket with GIT. As I am new to GIT, I am doing a lot of mistake and try to learn from the mistake. 🙂

Let me describe my scenario. I made a repo in Bitbucket and push my local repo there. It was nice but when I examine the source I found that my DOC folder is also in source. But I planned to ignore this DOC folder and upload them in upload section. So I place the DOC folder name in .gitignore and push after commit. From source tab I found that the DOC folder is still there. I was upset for the moment, but I searched for the solution and found that I must remove that folder from my local repo with git command and then push the change.

Here is the command for git to remove a folder,

git rm --cached -r <folder_name>/

Also you can remove file with following command,

git rm --cached <file1_name>

Happy gitting friends 😛 😀

(Visited 44 times, 1 visits today)

Leave a comment

Your email address will not be published. Required fields are marked *