Reputation: 493
I'm a little confused by doing a pull to a server whereby I have a .gitignore that is set to ignore the user generated files. Basically I'm developing and pushing to github, and then deploying with a pull, but I keep deleting my user generated content.
.gitignore looks like this:
audio/*/*/*.mp3
audio/*/*/*.wav
audio/*/*/*.ogg
videos/*/*/*.mp4
videos/*/*/*.mov
videos/*/*/*.mpeg
images/*/*/*.jpg
images/*/*/*.jpeg
images/*/*/*.png
images/*/*/*.gif
images/*/*/*.bmp
images/*/*/*/*.jpg
images/*/*/*/*.jpeg
images/*/*/*/*.png
images/*/*/*/*.gif
images/*/*/*/*.bmp
I'm not especially knowledgeable with git, so I know I'm doing something wrong.
What is it I'm doing wrong?
Upvotes: 0
Views: 87
Reputation: 2058
I am not observing the clobbering behavior you speak of:
Environment 1:
$ mkdir test
$ cd test
$ git init .
Initialized empty Git repository in /*****/test/.git/
$ cat > .gitignore <<'EOF'
> audio/*/*/*.mp3
> audio/*/*/*.wav
> audio/*/*/*.ogg
>
> videos/*/*/*.mp4
> videos/*/*/*.mov
> videos/*/*/*.mpeg
>
> images/*/*/*.jpg
> images/*/*/*.jpeg
> images/*/*/*.png
> images/*/*/*.gif
> images/*/*/*.bmp
>
> images/*/*/*/*.jpg
> images/*/*/*/*.jpeg
> images/*/*/*/*.png
> images/*/*/*/*.gif
> images/*/*/*/*.bmp
> EOF
$ touch test.txt
$ mkdir -p audio/one/two/
$ touch audio/one/two/three.mp3
$ touch audio/one/two/three.txt
$ git add -A :/
$ git commit -m "Initial commit"
3 files changed, 19 insertions(+)
create mode 100644 .gitignore
create mode 100644 audio/one/two/three.txt
create mode 100644 test.txt
$ git remote add origin https://***********@bitbucket.org/***********/testrepo.git
$ git push -u origin --all
Environment 2:
$ git clone https://***********@bitbucket.org/***********/testrepo.git
$ cd testrepo
$ touch test2.txt
$ git add -A :/
$ git commit -m "Commit two."
$ git push
Environment 1:
$ touch audio/one/two/three.wav
$ git pull
$ ls -l audio/one/two/
total 0
-rw-r--r-- 1 *********** staff 0 Sep 25 11:37 three.mp3
-rw-r--r-- 1 *********** staff 0 Sep 25 11:37 three.txt
-rw-r--r-- 1 *********** staff 0 Sep 25 11:57 three.wav
The files are still there.
Upvotes: 0
Reputation: 5267
.gitignore is for ignoring files when you are trying to commit files. It does not look at that when you pull from the repository.
Upvotes: 3