1.

Explain steps involved in removing a file from git index without removing from the local file system?

Answer»
  • Sometimes we end up having certain files that are not needed in the GIT index when we are not being careful while using the git add command. Using the command git rm will remove the file from both the index and the local working tree which is not always desirable.
     
  • Instead of using the git rm command we can use the git reset command for removing the file from the staged version and then ADDING that file to the .gitignore file to avoid repeating the same MISTAKE again.
git reset <file_name> # remove file from indexecho filename >> .gitingore # add file to .gitignore to avoid mistake repetition.


Discussion

No Comment Found