Sometimes as a new programmer or developer we pushed our local committed files to remoted repository. So, as a new programmer or developer need to understand which files should commit and which shouldn't committed.
for security and others issues we shouldn't commit and push such files and folders (directories) like noude_modules, .env, npm packages, yarn.lock and many more depend on which project and development you're work on.
Suppose, if you mistakenly committed and push a file that you get warn from GitHub or GitLab or have security vulnerable that should remove at any possible way.
Then the git command you need to apply is: git rm -r --cached
By this command you can remove your desired file from the commit and when you git add .
, git commit
and git push
then you can able to remove that file from remote repository.
You can add these file to gitignore
, so that these file will never commit and push to remote repository.
Top comments (0)