After holding off for a while, I finally got round to moving all of my client projects into a single (private) GitHub repo and the whole process was a lot less painful than I expected it to be. In the end, I only had one issue and that was crafting my .gitignore file so that the WordPress core files for each project didn’t all get uploaded to my repo (that would be a sure way to upset the fine folks at GitHub). The file wasn’t too tough to get right, but I thought it worth sharing in case anyone else is struggling with the same thing.
So here is a .gitignore file that will exclude all WordPress core files from your repo so that only your themes and plugins will be uploaded – this works recursively, so that it will ignore all the copies of WordPress you have in the sub-folders of the repo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This still includes a couple of core files named index.php. If I add index.php to the .gitignore it will then ignore them inside the folder for each individual plugin/theme. Is there a way around this?
Adding ‘/index.php’ should sort that out for you I think – haven’t tested it though.