Most people prefer version control for coding. They cannot even think of doing coding without version controlling. Salesforce uses version controlling for enhanced source code control. Though I have experienced working with several version controlling tools such as SVN, CVS etc. I have a personal inclination toward Git and I feel that it is the best available version controlling option today. Git happens to be far more powerful than any other accessible version controlling tool.
The Git Era
Git has today emerged as the most effective and really dominant source code repository and is widely accepted and acknowledged by the developer communities. Git has both local, as well as, the remote repository that makes it more flexible and much better than any other repository tool for coding. Here is a guide to using Git + Eclipse in Salesforce for Version Controlling. I would enjoy helping individuals to effectively use Salesforce GitHub and Git for collaborating and being more productive.
Step 1: Once you complete downloading and installing Force.com IDE, you would be installing the Git plug-in. The name of this plug-in is EGIT. You easily download EGIT from http://www.eclipse.org/egit/.
Step 2: You now need to get the specific Salesforce code right into your own local workspace.
Step 3: It is time for you to start configuring the “Local Repository”. You simply need to Right Click on Project | Team | Share Project.
Step 4: You then require selecting Git as your option and then click on “Next”
Step 5: You simply should go about clicking on ‘Create’. Then choose ‘Parent Directory’ and simply click on ‘Finish’. At this step you would be mentioning the local repository name along with the path.
Step 6: When you click lightly on the “Finish” key, you would be observing that all files found in Eclipse are actually marked with “?” a question mark. Question marks imply that Git has no idea regarding what exactly to do with those files; either you could schedule those files for commit or add some of those files in ignore.
Step 7: At this step, you would be committing your changes or modifications to your newly or recently developed “Local Repository”. For doing that, you need to click on Project | Team | Commit.
It is certainly a very good practice on your part to provide meaningful comments in the context of each commit so that developers could easily recognize the modifications/changes.
Step 8: Till now you had committed only your modifications to your local repository. But now it would be the most important crucial and final part where you would be moving your code right from your local repository to the real remote server. For that, you should be creating a remote repository as Salesforce Git. Please browse through Google for ‘Ways to create successfully your remote repository in the Git?”. Once we are through, you should go about configuring the same in the eclipse. For that, you should click on Remote | Create Remote.
Step 9: Now a different pop-up window would be coming up. First of all, choose the option “Push”. Then you could name the remote repository. “Push” implies that you would be saving changes or modifications on the remote repository. “Fetch” means you would be going and fetching the code from your remote repository.
Step 10: Click lightly once on the “Ok” key then, a different pop-up window would simply open. Here you should consider clicking on the Change key or button. In this pop-up window, we would be providing the Git URL, password, and username and then, click on finish.
Step 11: Simply click here on “Advanced” button. Once the new or a different pop-up window, comes up choose the options as per the screenshot and then click on finish.
Step 12: Finally it is time to simply click on “Save”. Now your remote repository has also been configured. Try checking if it is running properly now.
Step 13: Here at this juncture you would be pushing the code straight from your “Local Repository” to the “Remote Repository”.
Step 14: Once you are done with the push, you would be finding that all your code is transferred from “Local Repository” to the “Remote Repository”.
Hope this guide would prove to be helpful for absolutely new learners.
Author Bio: Jonathan Brown is a reputed Salesforce expert who is attached to a private organization in Boston. He possesses sound knowledge about Salesforce Git and Salesforce GitHub. He enjoys guiding the newcomers on Salesforce version controlling.