I have a website on my ubuntu server. I normally write the code on my laptop and then copy it over using scp. I decided I could just push to a git repository on my laptop and pull it on my server. My git repository on both machines is in /var/www/html (being served by apache2).
The problem:
On my server, I have a symbolic link from /home/files to /var/www/html/files. I also have a file /var/www/html/images/image.png. This file and symbolic link don't exist on my laptop, so when I do a git push from the laptop, they don't get added to the repository.
I want:
to do a git pull on my server and have it replace all the the current webpages such as /var/www/html/home.php with the new version from the repository, while not changing the local files that don't exist in the repository such as /var/www/html/files/* and /var/www/html/images/image.png
When I do a git pull on my server, git seems to replace the parent directory of /var/www/html/images/image.png (/var/www/html/images) and so I can't find /var/www/html/image.png
anymore.
What I did (on the laptop):
$ nano /var/www/html/home.php (update the webpage)
$ git push
What I did (on the server):
$ ln -s /home/files /var/www/html/files
$ cp /home/some/random/image.png /var/www/html/images/image.png
$ git pull
I expected: to find a new version of /var/www/html/home.php and to still find the old /var/www/html/images/image.png
Instead: I found the new version of /var/www/html/home.php but no /var/www/html/images/image.png