Some questions about adding gitignore after several commitments

advertisements

I have created my gitignore file and have added it to my local repo. I understand that I have to do git rm --cached. So here are my questions.

  • When in the process should I do git rm --cached? before git add --all . or git commit -m "comments" or git push origin master? Also before or after committing (or pushing) my gitignore?
  • Is git rm --cached the whole command? or must I always qualify it with, for example, git rm --cached /bin/*?
  • my mac computer gave me a warning about naming my file .gitignore vs android.gitignore. If I simply do .gitignore the file will be hidden. Does github care which one I do?

  1. git rm --cached filename is used to stop tracking a file without deleting it from your working tree. Example: You create a new file, start tracking with git add, and then commit. You want to ignore the file, so you add it to .gitignore git is still tracking the file when you make changes to it, this is when you git rm --cached git thinks the file is gone, but it's still there in your local directory.

  2. git rm --cached filename for whichever file you want to ignore.

  3. yes, it needs to be .gitignore