Solution git configured .gitignore not in force

Usually we hope to keep clean code into the warehouse, which do not include project development tool to generate a file, or temporary files after the project is compiled. However, when we use git status to view the status of the work area, some files are not always prompted track. So, we want to help our git ignore these files are no longer reminders.

Fortunately, git have considered this point. We can build a .gitignore file in the root directory of the project, the file is used to configure which files or directories are not the track. The rules are simple, in that file, write down what you do not want to track files, one per line. Blank lines and lines beginning with # are filtered out. Here's an example to illustrate the use of small .gitignore file:

  # Ignore bin folder

  bin /
  # ignore obj folder
  obj /

*.class
  *.apk
  bin/
  gen/
  .settings/
  proguard/

Under normal circumstances, after so configured on it. But sometimes, we find a configuration option does not work, which is why Nigeria? Obviously there is no problem with it, people feel very puzzled.

In fact, the real reason is .gitignore only those files have not been ignored track, if some files have been included in the version management, modifying .gitignore is invalid. A simple solution is to put the local cache deleted (changed to not track state) before submitting.

RM -R & lt --cached Git.
Git the Add.
Git the commit -m 'Update .gitignore'

Guess you like

Origin www.cnblogs.com/cuihongyu3503319/p/11284406.html