.gitignore files do not affect git fetch/git pull
A .gitignore
file has no effect on remote git operations; it is only relevant when adding files to commit them (and also has no effect on already-tracked files).
As such, to receive all files (including files that are in the repository but now ignored) - the only thing that's required to do is fetch/pull as you would ordinarily do. If the .gitignore
files have been added to the repository, they will be received as with any other file in the repository.
Files aren't in the git repo?
If there are files that are in a checkout somewhere, but aren't in the git repository that you wish to receive, they need to either be checked in, or downloaded directly. To add files that are ignored you'll need to use the --force
flag:
$ cd /my/app
$ git add somefiles/
The following paths are ignored by onhe of your .gitignore files:
somefiles
Use -f if you really want to add them
fatal: no files added
$
Note specifically Use -f if you really want to add them. It's not impossible (or even difficult) to add ignored files to a repository, it simply requires you to confirm it's really what you want to do:
$ git add -f somefiles/
$ git commit -m "adding some files"
[master 98380d5] adding some files
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 somefiles/empty