WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Sep 10 2015

Using Git for Beginners: Github for Desktop

As I have mentioned in my introductory two posts, Using Version Control and My Development Workflow, I use Git in my development. This post will focus on using Github for Windows GUI with lots (maybe too many) images (I prefer images because I am typically too impatient to watch videos). Github for Desktop is the first of three posts that I will walk-through and demonstrate. I personally have never used Github for Desktop but I know a few people that do. The primary reasons I never used it are twofold: (1.) by default the repositories are public and (2.) I was too cheap to pay for the private repositories.

As I mentioned and in way of review, I am going to share how to use Git with 3 different methods:

  1. Github Desktop
  2. Bitbucket's SourceTree
  3. TortoiseGit

Summary

To use Github for Deskotp, we will take these steps:

  1. Install Github for Desktop
  2. Setup Github for Desktop
  3. Create the Github Repository (Repo)
  4. Add WordPress
  5. Remove Default WordPress Themes (this step is only for Genesis developers)
  6. Add Genesis & Genesis Sample to the Github Repo
  7. Begin Development with Git
    1. Change Genesis Constants (functions.php)
    2. Publish Github Repo
    3. Change Theme Details (style.css)
    4. Sync Github Repo
  8. Reverting with Github

Using Github for Desktop

1. Install Github for Desktop

To install Github for desktop, download the installation file from Github. On the Security Warning, click Install. This will download the full installation file and install the program.

Install Github
Install Github

After installing the program, you will need to setup Github for Desktop.

2. Setup Github for Desktop

To setup Github for Desktop, you first need to enter your Github credentials. If you have not already, create a Github account. Even if you do not plan to use Github for your site development, it is good to have a Github account for entering issues with plugins and various other libraries and repositories that you may use. If you already have a Github account, skip to Step 2.3: Complete Setup.

Setup Github for Desktop
Setup Github for Desktop
Setup Github for Desktop
Setup Github for Desktop
Setup Github for Desktop
Setup Github for Desktop

2.1 Create Github Account

To create a Github account, go to Github:

  1. Enter a username
  2. Enter your email
  3. Create your password
  4. Click Sign up for Github

Create Github Account

2.2 Select Plan

After the intial form, you will be asked to select a plan. If you want to use the free plan, just click on Finish sign up.

Create Github Account
Create Github Account
Create Github Account

2.3 Complete Setup

The first time you run Github, you will need to setup Github for Desktop.

  1. Login: To create the Github repo, enter your Github account information and click on Log in.
  2. Configure: Here you will enter your name (public) and email (public) and click on Continue.
  3. Then it will search for your repositories. Either wait for it or click on Skip, which is what I did.

Then you will be brought to the tutorial screen, and now you are ready to create the Github Repository.

3. Create the Github Repository (Repo)

Create Github Repo
Create Github Repo
Create Github Repo
Create Github Repo
Create Github Repo

This will create .gitattributes (which you should not worry about at this time) and .gitignore.

# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
view raw .gitignore hosted with ❤ by GitHub

If you would like, please feel free to replace/merge the .gitignore with one of the WordPress .gitignore files (.gitignore versions WordPress, .gitignore does not versions WordPress)).
Github Repository Settings
Github Repository Settings
Github Repository Settings

4. Add WordPress to the Github Repo

Next you would either clone WordPress from Github, download it from WordPress.org, check it out of the WordPress SVN, or ideally use your own copy with your default themes and plugins already packaged with it.

Add WordPress
Add WordPress
Add WordPress

These next two steps are for Genesis developers specifically where we will remove the default WordPress themes and add the Genesis themes.

5. Remove the Default WP Themes from the Github Repo

If you do not have a pre-packaged WordPress with Genesis and your child theme, then you will want to remove the WordPress default themes.

Remove Default WP Themes
Remove Default WP Themes

6. Add Genesis & Genesis Sample to the Github Repo

Next we want to add our Genesis theme and our default Genesis child theme, in this case, the Genesis Sample.

Add Genesis & Genesis Sample
Add Genesis & Genesis Sample
Add Genesis & Genesis Sample
Add Genesis & Genesis Sample

7. Begin Development

Now, we are ready to begin development. To begin with, we have this functions.php file.

<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'Genesis Sample Theme' );
define( 'CHILD_THEME_URL', 'http://www.studiopress.com/' );
define( 'CHILD_THEME_VERSION', '2.1.2' );
//* Enqueue Google Fonts
add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
function genesis_sample_google_fonts() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,400,700', array(), CHILD_THEME_VERSION );
}
//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Add support for custom background
add_theme_support( 'custom-background' );
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
view raw functions1.php hosted with ❤ by GitHub

Now, we want to make a few modifications:

7.1 Change Genesis Constants

The first thing I usually do is change my constants.

//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', 'WPSmith Theme' );
define( 'CHILD_THEME_URL', 'http://wpsmith.net' );
define( 'CHILD_THEME_VERSION', '1.0.0' );

Git Development
Git Development
Git Development

7.2 Publish the Github Repo

This is usually when I would publish the repository with Github. Now publishing the git repository in Github only creates the repository. It does not push the existing files or commits. This can be done earlier, but I tend to hold this off until this point. Sometimes I would do it before the Genesis constants change, sometimes much after. It really depends on you.

Publish Github Repository
Publish Github Repository
Publish Github Repository

7.3 Change style.css

Next, I change my style.css to match. At first, I have this with my CSS:

/* # Genesis Sample Child Theme
Theme Name: Genesis Sample Theme
Theme URI: http://my.studiopress.com/themes/genesis/
Description: This is the sample theme created for the Genesis Framework.
Author: StudioPress
Author URI: http://www.studiopress.com/
Template: genesis
Template Version: 2.1.2
Tags: black, orange, white, one-column, two-columns, three-columns, left-sidebar, right-sidebar, responsive-layout, custom-menu, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

After personalizing style.css, I now have this:

/* # WP Smith
Theme Name: WP Smith
Theme URI: http://wpsmith.net/
Description: Sample Child Theme Git Process.
Author: WP Smith
Author URI: http://wpsmith.net/
Template: genesis
Template Version: 1.0.0
Tags: black, orange, white, one-column, two-columns, three-columns, left-sidebar, right-sidebar, responsive-layout, custom-menu, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready
License: GPL-2.0+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/

7.4 Sync the Github Repo

Then, I commit those changes and sync the repository.

Publish Github Repository
Publish Github Repository
Publish Github Repository
Publish Github Repository

So now you should be familiar with basic Github for Desktop usage. Next, I will briefly show how to revert files.

Reverting with Github

Here is how you can revert changes and track those changes with Git commits. Click on the Revert at the top right.

Revert Git Changes with Commit
Revert Git Changes with Commit

Here is how you can revert changes and not track those changes with Git. Click the gear/cog icon at the top right and click on "Undo most recent commit"

Revert Git Changes
Revert Git Changes

Conclusion

We have reviewed general usage of Github for Desktop. For your convenience, this is what we covered:

  1. Install Github for Desktop
  2. Setup Github for Desktop
  3. Create the Github Repository (Repo)
  4. Add WordPress
  5. Remove Default WordPress Themes (this step is only for Genesis developers)
  6. Add Genesis & Genesis Sample to the Github Repo
  7. Begin Development with Git
    1. Change Genesis Constants (functions.php)
    2. Publish Github Repo
    3. Change Theme Details (style.css)
    4. Sync Github Repo
  8. Reverting with Github

Written by Travis Smith · Categorized: Genesis

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in