Getting to know GitHub and MavensMate 2

I just recently made the switch from Eclipse with SVN to Sublime with GitHub and have been impressed so far with how enjoyable the transition has been. I am particularly impressed with the GitHub client and how easy it was to get started.  There are some really informative blogs and tutorials out there for using git with the command line, but I prefer using the GitHub client, it’s simple to use and allows you to get started quickly.

Before you get started make sure you have a GitHub account and have installed the GitHub client. Then, follow the steps outlined below.

  1. Click on your profile and click on the Repositories tab.
  2. Click on the New button.
  3. Enter a Name for your repository.
  4. Click the checkbox next to Initialize this repository with a README.
  5. Click the Create repository button.

Next you will need to create your project, in this example I will be using MavensMate. As usual, I recommend you trying this out with a Developer Org first.

  1. Open Sublime Text.
  2. From the MavensMate menu, select New Project from the Project sub menu.
  3. Enter the Name from Step 3 above for the Project Name.
  4. Enter your Username and Password (appended with your security token).
  5. Click on the Project Metadata tab, for now just leave the defaults checked, but know you can add more if desired.
  6. Click the Create Project button.
  7. Close Sublime Text.

Since both your project and repository have the same name, before we can Clone the repository, we will need to rename the project folder.

  1. Navigate to the directory where your project was saved to.
  2. Rename your project folder by adding .bak to the end of the folder name. Keep the window open.
  3. Open up the GitHub client and add your Account if you haven’t already.
  4. In the top left hand corner of the client, click the + sign.
  5. Click on the Clone tab.
  6. Choose the repository you created above.
  7. Navigate to the same directory where your project is saved to.
  8. Click the Clone {!repositoryName} button.
  9. Copy all the contents from the .bak folder over to the repository folder. (You can delete the .bak folder)

You now have your project ready to be committed to your repository, but first I recommend not committing all files. You can exclude specific files in a .gitignore file.

  1. Open your project in Sublime Text.
  2. Right click on your project and select New File.
  3. Add the following lines:*.sublime-project*.sublime-settings*.sublime-workspaceconfig/.*
  4. Save as .gitignore.
  5. Switch back over to the GitHub client.
  6. You should see on the Changes tab all of your files from besides what you ignored above.
  7. Enter a comment and brief description and click the Commit to Master button.
  8. Click the Sync symbol in the top right hand corner.  Sync

Now let’s try it out.

  1. Go back to Sublime and update your file, by adding Hello World!
  2. Save your changes.
  3. Switch back to the GitHub client.
  4. You should see your README file listed under the changes tab.
  5. You will also notice your change highlighted on the right hand side.
  6. Commit this change and Sync it.

What’s that you say? You don’t want Hello World in your README file, no problem.

  1. In GitHub, click on the History tab.
  2. Select the Hello World commit from the list.
  3. Click on the settings icon just above the highlighted change on the right hand side and select Revert this Commit.


  1. Click on the Sync button.
  2. Open your README file again and notice “Hello World” is gone!

Things can definitely get more complicated when you start forking, branching and working with multiple developers, but hopefully this will help get you started. On a side note: it appears Salesforce has something available in pilot/beta as of 9 months ago, take a look at this idea on the IdeaExchange.




Leave a comment

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

2 thoughts on “Getting to know GitHub and MavensMate