It’s 12+ hours in a hackathon. You’re brain is starting to turn to much, and you are downing coffee like it’s water. Blearily you look up as the hackathon organizer is announcing git commits are due in the next hour. You’ve read the posts about setting up a git repo,  and have a repo cloned on your machine. But you are not sure how to take all of the force.com code and metadata, and check it into git. Here is a “I’ve been up all night at a hackathon” user’s guide to getting it done, and getting back to coding. (note: you can also find a more detailed write up here )

1. Install the force.com CLI

Grab the binary for your chosen operating system, download it, and copy it into a directory that is in your path your command line.

On a mac, you typically want to drop it into something like

You can check by executing the following on the command line:

2. Change directories into your git repo that you cloned earlier.

For example, if my repo is called quinton-hackathon, and I cloned it using git clone quinton-hackathon

into my home directory, I’d have a directory structure like the following:

You want to make sure that you change directories into your equivalent of quinton-hackathon

3. Authenticate into your salesforce environment

From the command line, type:

You will prompted to login via the browser. Once you log into force.com, you can close the window and get back to the command line.

4. Grab the metadata

You are almost done! Grab the metadata using the following command:

This will create a directory called ‘export’ that will contain all of your salesforce code and metadata. It’s this directory you need to check in.

5. Commit your code.

Last step. Commit your code with the following commands executed from your repo home directory:

And that’s it! Follow these simple steps, and get more time back for hacking and coffee 🙂

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS