Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

How can I automate the process or retrieving a snapshot of my code and configuration and committing it to git?

We have a ton of development happening in my org, and I'm currently saving daily snapshots in git, to keep a handle on our expanding configuration and code.

I'm currently using Ant and EGit, both from within Eclipse. A downside is that I have to manually run the ANT retrieve macro and then commit to git each day. I'd love to automate this process, but I'm not sure how to.

share|improve this question
    
What don't you know how to do? Just use the command-line versions of both, which have tons of documentation. –  jkraybill Dec 19 '12 at 3:06
    
@jkraybill Are the command-line versions included in Eclipse, or would I have to install and configure them separately? If they're included in Eclipse, how can I find/access them? –  Benj Dec 19 '12 at 13:53
    
Install is at Setup > Develop > Tools for Force.com Migration Tool; docs at wiki.developerforce.com/page/Migration_Tool_Guide; for git, google is your friend. –  jkraybill Dec 20 '12 at 4:12
    
@jkraybill I know how to install the tools themselves (I'm already using them). The question is, how do I get to the command-line versions? –  Benj Dec 24 '12 at 14:52
    
The Force.com Migration Tool is only a command-line interface (via Ant), so you'll get it if you follow the link to install and read the docs. For git, search git command line (your operating system) to get your command line client of choice. The Migration Tool is invoked via "ant deploy" and similar commands from a command line; git is invoked via "git clone", "git commit" etc from a command line. –  jkraybill Dec 28 '12 at 0:25

1 Answer 1

up vote 8 down vote accepted

If you can use the command-line versions of these tools, then you could wrap all of this up with a script and set it to run on a schedule (cron or other). I didn't test this, but this would be a bash (OSX, Linux, Unix) version of what you could do...

#!/bin/bash

# clear out existing code
# this is important to capture deletes
rm -rf src/*

# run ant
ant retrieve

# do a git snapshot
git add .
git commit -m "daily snapshot"
git push
share|improve this answer
    
Finally got around to doing it - this was perfect, and is now set up in a cron job –  Benj Jan 21 '13 at 2:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.