7

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.

5
  • What don't you know how to do? Just use the command-line versions of both, which have tons of documentation.
    – jkraybill
    Commented Dec 19, 2012 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
    Commented Dec 19, 2012 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
    Commented Dec 20, 2012 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
    Commented Dec 24, 2012 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
    Commented Dec 28, 2012 at 0:25

1 Answer 1

8

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
1
  • Finally got around to doing it - this was perfect, and is now set up in a cron job
    – Benj
    Commented Jan 21, 2013 at 2:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .