Member-only story

Ignore files in your git repository

vahid_jani
Jun 18, 2022

There are times that you want to have some files in your project but only on a specific machine that you are working on(local repo) and not on the remote repo. So what should we do ?

The solution is “.gitignore” file. simply create the file if it doesn't exit and then write the name of the files in to this file:

touch .gitignore
vim .gitignore

then you can write name of the files in there as below example:

myConfig.conf
test.py
...

Then you need ro add and commit it to your remote repo. In case you have already tracked some of those files you need to untrack them before commit, using the “rm — cached” command:

git add .gitignore
git rm --cached <file path>
git commit <some message>

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

vahid_jani
vahid_jani

No responses yet

Write a response