Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Remove files or folders from remote git
Truemark Technology profile imagePrabin Poudel
Prabin Poudel forTruemark Technology

Posted on • Edited on • Originally published atthedevpost.com

     

Remove files or folders from remote git

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 project that had just started, I accidentally pushed IDE folder to remote repository and I was there googling again, so I thought, why not write 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 repository. Let's get started!

Remove file or folder from remote repo only

# Remove a single filegitrm--cached password.txt# Remove a single foldergitrm--cached-rf .idea
Enter fullscreen modeExit fullscreen mode

Remove file or folder from both remote repo and local

# Remove a single filegitrmpassword.txt# Remove a single foldergitrm-rf .idea
Enter fullscreen modeExit fullscreen mode

After removing file or folder, we shouldn't forget to add them togitignore before we commit and push to the repo again. Or we will be back to the start of the blog removing those again!

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

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

More fromTruemark Technology

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp