Friday, April 13, 2018

GIT Ignore


Purpose:

Sometimes, we do not want to commit the sensitive file such as config file to git. In order to handle it, we can use .gitignore file to claim that which files will be excluded for the committing.

Step 1:

Create a file called “.gitignore”
touch .gitignore


Step 2:

Write the untracked file’s name to “.gitignore” file
echo xxx.xxx >> .gitignore


Step 3:

Sometimes, if you want to remove some committed files from git, you need to do the following commands
git rm --cached xxx.xxx


Step 4:

The normal way to commit
git commit -m "Remove the committed untracked file"
git push




No comments:

Post a Comment