How to Ignore certain files from Git commit (modified but never need to commit)

Sometimes we may need to ignore certain modified files from Git commit (Eg: config/database.yml).
This can be done by issuing  the following command from your project path
  • git update-index --assume-unchanged config/database.yml
Or in case of folder
  • git update-index --assume-unchanged folder-name/
In the case of a new folder or file (Not added to GIT before) we can ignore by adding it to .gitignore file
  • Create a .gitignore file if doesn't exist in your project path
  • Add the required folder or file path in it.
          # Ignore bundler config
             .bundle

         # Ignore the default SQLite database.
            db/*.sqlite3

         # Ignore all logfiles and tempfiles.
           log/*.log
           tmp

Comments

Popular posts from this blog

How to SSH to remote server without entering password each time.

How to redirect a URL in NGINX

Ruby on Rails Installation on Windows 7