How to add an existing website to Git

I’ve been making small changes to my Joomla 1.5 (PHP) website for about two years without using any kind of version control, but recently I heard that Git is a good one and it is even supported by MS Visual Studio 2012. So I installed Git Client on my Ubuntu Server and did typical steps to add my website to the local repository.

cd ~
git init
git add www/
git commit -m "First commit" www/

To prevent Git from commiting lots of jpg and png files that are added dynamically by web site users I added image directories to .git/info/exclude:

# git ls-files –others –exclude-from=.git/info/exclude
# Lines that start with ‘#’ are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
www/media/
www/images/
www/components/com_virtuemart/shop_image/

Leave a Reply

Your email address will not be published. Required fields are marked *