What happens to gitignored, untracked files when pulling them from the remote repo?

git, gitignore

Solution

If the file is still tracked and not ignored in the remote repo, YES. When pulling, it will update the changes to that file. If the file is modified in your local machine, it will raise a conflict.

Actually when you untrack a file, you must push the changes to remote repo, so that the file will be untracked in remote repo as well. If you want to untrack a file only in your local machine there are other ways. Refer: https://stackoverflow.com/a/11209188/1365319

You can also share your ".gitignore" file with your colleges by committing it to the repo, so that they don't accidentally add the file to repo.

Problem

If I clone a repo and subsequently add one of the downloaded files to .gitignore, I understand I will have to "untrack" them so the .gitignore rules will apply. After untracking them, and are therefore gitignored, are they re-tracked when pulling any updates to those file from the remote repo again?

Original source

Related problems