Git & GitHub for theme-makers
After a chat with the lovely @saturnthms, I thought I would make a post for theme-makers who would like to use Git and GitHub to manage their work, but are unsure of how to start. This post assumes you’re prepared to use the command line. If you’re not, you can apply much of what’s written here to the GitHub Desktop software. The command line really is the best way to go though!
What is Git? What’s GitHub?
Git is a versioning system. It tracks your files as you work on them and allows you to record a deep, detailed record of changes. GitHub is an online hub for projects managed with Git. It’s here to make sharing software easier.
Kayla Ngan at Microsoft wrote an article explaining Git, and the GitHub team put up a cute YouTube video explaining GitHub.
Sweet! How do I get started?
First, sign up on GitHub’s website. You’ll need your email address and password to associate your local Git software with your GitHub account. Take a second to set up your profile: it’s the face of all the work you’ll do on your themes!
Next comes setting up Git locally, on your machine. It’s different between macOS and Windows. Skip to the heading that applies to you, and then move on to Configuring Git
Command line setup on Windows
Download and install Git for Windows. Select all the default options through this process. When it’s done, you’ll have Git Bash, a command-line environment you can use to run git and all other manner of software.
Launch Git Bash and type git --version. You should see something like git version 2.13.1, but the exact number is not important. Also take some time to learn some general commands that will make your life easier. You’ll most often be using cd to change directories and mkdir and touch to make folders and files, respectively.
Command line setup on macOS
macOS comes with Git installed! Open the Terminal application (by searching for it in Spotlight or finding it in Applications > Utilities). Type git --version. You should see something like git version 2.13.1, but the exact number is not important. Also take some time to learn some general commands that will make your life easier. You’ll most often be using cd to change directories and mkdir and touch to make folders and files, respectively.
Configuring Git
Now that Git itself is installed, we have to set it up. Open your command line and run the following two commands:
git config --global user.name "Beyonce Knowles" git config --global user.email "[email protected]”
You’ll want to use whichever user.name you want to be addressed by, whether that’s your theme-making handle or your real name. Your user.email must be the one you used when you signed up for GitHub.
Your first project
Back on GitHub, make a new project. Call it something like my-theme and keep in mind that it’s generally best to use all-lowercase names and dashes to separate words. You don’t have the option to make private repositories if you use a free account, but that’s ok. Ignore the box about making a README—we’re going to make one ourselves.
On the next page, you’ll see instructions for linking this repository to your local machine. Copy the first set of instructions.
Use your command line to navigate to the place you usually store your themes. Ex: cd ~/projects/themes and then pwd to make sure you’re in the right place. Make a new folder to match the name of your repository with mkdir my-theme and then cd into it (cd my-theme).
Once inside your new folder, paste the commands you just copied from GitHub. Here’s a breakdown of what they do:
# add text into a new README.md file echo "# my-theme" >> README.md # tell Git we're going to have a project here git init # prepare our recent changes to be committed in history git add README.md # preserve these changes and describe them as "first commit" git commit -m "first commit" # tell git which github project this stuff is associated with git remote add origin https://github.com/myusername/my-theme.git # send this new commit to github git push -u origin master
When working with Git and GitHub, you’re pretty much always going to follow this workflow:
make changes to your files
git add them to tell git you want to keep them
this can look like git add * to add all files or git add <filename> to add just one.
git commit -m “a message" to preserve these changes and describe them
git push them to send them off to GitHub.
There’s a lot more about how best to use git, but that would be a separate post. For now, using git at all is better than not using it. Over time, you will be able to see more about your process as a developer, and having your themes on GitHub makes them that much easier to share!
Be sure to use the README.md to document the features of your themes, and give advice on how to edit them, if you intend them for such a thing!
This Git guide makes a handy reference point for beginners; as does Oh Shit, Git! once you start running into bigger problems.
Happy theming!















