GIT is great, it has made collaboration with other developers so easy, I can’t thank GIT enough. But GIT is vast and not every command remains on my mind. I find myself googling over and over again to get that right GIT command that can solve my problem. Recently when working on one of the projects that had just started, I accidentally pushed the IDE folder to the remote repository and I was there googling again, so I thought, why not write a blog for this? I can always come straight to my blog if this happens again and I can also help my fellow developers this way, right? All sensitive information and IDE related folders should be added to gitignore so they are not tracked by git. You may already know this, but it doesn’t help if your file or folder is already in the remote repository. Today we will learn how we can remove files or folders from remote repositories. Let’s get started! Remove file or folder from remote repo only git rm password.txt git rm -rf # Remove a single file --cached # Remove a single folder --cached .idea Remove file or folder from both remote repo and local After removing a file or a folder, we shouldn’t forget to add them to before we commit and push to the repo again. Or we will be back to the start of the blog removing those again! gitignore Straight and sweet, that’s it. Any confusions? Have a better solution? Please comment below, it’s never a bad idea to have a healthy conversation. Thank you. See you again! References: Remove file or folder only from remote repo This post was first published on . Dev Post by Truemark