Automated Daily Backup of Salesforce Using ANT Migration Tool and GIT

In few previous articles, I have talked about how to use “ANT Migration tool in Salesforce” and “How to Use EGit plugin in Eclipse to work with Git“. So to make this article short, I assume that you are already familiar with ANT Migration tool provided by Salesforce and Git.

During project development life cycle it is very essential to backup your code and Configurations daily. However sometimes developers forgot to commit changes in Git, may be  because of workload. It may create an issue if someone wants to check back history of code for that duration, there will be no use of having code repository in place if it cant help us to get out of problem.

In this article, I will move one step further and explain how to setup automated script which will run on your System startup and commit backup of your Salesforce organization into local Git repository without any manual interference.

Salesforce Automated Script for Data Backup Using CommandLine
Salesforce Automated Script for Data Backup Using CommandLine

Creating First Application in Heroku using Eclipse

Hello Readers, in this article we will see step by step procedure to deploy your first (Hello World) program in Heroku. There are two ways, first going through series of Commands of “Heroku” and “GIT” and other simple and smart way is to use Eclipse Capability with Heroku. To make things easier we will go by second method.


This tool / blog post is deprecated. Please follow this guide to deploying applications to Heroku from Eclipse. If you still want to follow this post, then download Eclipse plugin for Heroku from here.


Installation and Set up:
First we will need to Install Heroku Plugin in Eclipse. To install it, Navigate to “Help | Install New Software” and click on “Add” button.

Give any name in website like “Heroku Plugin” and enter this URL in Location and click on “Ok” and Finish Installation. It will install the Heroku Plugin required to start your first Plugin.

Next step is setting up your Credentials for Heroku :

Navigate to “Window | Preferences | Heroku”, Here either enter your UserName and Password of Heroku Account and click on “Login” or enter you API key, which you can find by logging into your Heroku Account.

Setting up Credentials for Heroku in Eclipse
Setting up Credentials for Heroku in Eclipse

Authenticate Git using SSH protocol with Eclipse and Egit – Salesforce

In Previous article, i have explained step by step approach to configure Git for Salesforce using Eclipse and Egit plugin. However, i have explained the “https” method to connect Git directly. There are several repositories which does not support the “https” protocol and prefer “SSH” (Secure Shell) protocol.

So, in this article i will extend the previous one by showing how to connect git using “SSH” protocol. In this article i am referring

We will need to generate the private key (RSA) which will be unique and locked with the help of secret passphrase.

In Eclipse, Navigate to “Windows | Preferences | General | Network Connections | SSH2″.

Configure Push for SSH Authentication in Git
Configure Push for SSH Authentication in Git

Click on button “Generate RSA Key” and after that provide secret Passphrase (dont forget this passphrase), now save the “private key”, if possible in “.ssh” folder which is located at “C:UsersUseName.ssh”.

Salesforce + Git + Eclipse + EGIT = Better and Distributed Source Control

During my J2EE and .Net days, I was much dependent on the subversion repository. I had never thought my code without SVN. When I moved to Salesforce few years back, the first thing I missed is code repository to have better source code control. As svn creates either “.svn” or “_svn” folder, it was not supported by the IDE and I struggled much to get it work out. Salesforce saves only real time information. So it is very difficult to know what was changed in past related to any issue as well as complete code backup.

Era of Git

Git has emerged as the most powerful source code repository and widely accepted by the developer communities. If I will talk about Git this article is going to be out of discussion scope.

Architecture of GIT
Architecture of GIT

Above figure describes Architect of Git. The one thing to notice in above figure is that Git has local repository as well as remote repository which make it better and more flexible than any other code repository tool.

Remote and Local Repository in GIT
Remote and Local Repository in GIT

As you can see in above diagram also, user can work on completely different branch which is stored on his local repository and when he thinks that he is ready to push the code on Git, just commit the changes on remote repository.