10

We're using Git to manage our project, since multiple developers are working with it and we want to have a revision history.

We're also using the Force.com IDE for development.

I'm now seeing "File only saved locally, not to server" warnings in the Problems tab for each file in the .git subdirectory, which exists at the same level as the src subdirectory.

I'm surprised that the IDE is trying to push those files up to the Salesforce server. Is there any way to configure the IDE to ignore that directory? Is this a bug in one of the Salesforce plugins (they should only try to sync the src directory, or should ignore all directories starting with .)?

5 Answers 5

7

Well, I haven't really gotten a git + eclipse process "working" but I have at least gotten it to stop complaining about .git files, like so:

  1. Right click the project name and open "Properties" or "Force.com"->"Project Properties" (depends on whether you're seeing it in "Package" or "Navigator")
  2. Expand the "Resource" part of the tree
  3. select "Resource Filters"
  4. Click "Add..."
  5. add a filter to "Exclude all" "Folders" and "All Children", where Name matches ".git".
2
  • Thanks! This worked also for me. No warnings about git blobs anymore! :-) Commented Sep 21, 2012 at 15:48
  • 1
    Use jejese answer, but don't forget to delete the errors & warnings from the Problems window. They won't go away on their own once you define the files/folders to exclude. They won't come back though either. Commented Jan 2, 2013 at 21:58
5

** See below for a slight improvement to this answer. **

My solution has been the following:

  • Have the .git directory at the same level as the src directory.
  • Always right-click on src instead of the project to Save/Refresh/Deploy.
  • Delete the warnings on the Problems tab if they come up.

I think I only got the warnings when I was just getting started with the Force.com IDE, and now that I've figured out an overall workflow, I don't get them any more.

Note that with this setup, it's fairly easy to make use of Git in my workflow:

  • Make sure all of my changes are committed in Git, choose "Refresh from Server" in the IDE.
  • Go back to Git to see if there are any changes (git diff) from the Development Org that haven't been logged to Git.
    • Either revert the changes (to the version in Git) and push those files back to the Org.
    • Or commit the changes so they're in the master repository.
  • To revert the Development Org to a particular branch, just check it out from Git and choose "Save to Server" for the src directory.
    • Follow that with a "Refresh from Server" and a git diff to see if there are changes that can't be pushed (e.g., schema changes).

I've included applications, classes, documents, layouts, objects, objectTranslations, pages, permissionsets, remoteSiteSettings, tabs, triggers and workflows from our Development Org in our Git repository. About the only thing I haven't been able to track is the contents of the package we're working on (so I don't know when things are added or removed).

Updated Directory Structure

Starting a new project, we've moved the .git folder one level higher, so the Force.com IDE doesn't even see it:

  • ProjectFoo/
    • .git/
    • .gitignore
    • IDE/
      • .project (Eclipse)
      • .settings/ (Eclipse)
      • salesforce.schema
      • src/
    • build_scripts/
    • documentation/
    • other_junk/

So, we use Git on ProjectFoo/, but from Force.com IDE we reference ProjectFoo/IDE/. This allows for keeping other files related to the project, that aren't pushed up to the Salesforce org.

3
  • This seems really complicated. Is this making your development cycle take a lot longer? I'm thinking about moving to Git since I've used it in the past and like it, but am also considering SVN and wondering if it would be easier.
    – paul
    Commented Sep 21, 2012 at 16:52
  • Doesn't seem very complicated once you start doing it -- it just looks complicated when written out :-). I don't see any advantage to using SVN over Git for version control.
    – tomlogic
    Commented Oct 1, 2012 at 18:07
  • This is how I do it. Commented Mar 12, 2018 at 16:05
1

What OS are you on? In order to avoid issues with the project meta-data files the IDE creates, I usually create a GIT repo inside of the src directory. The IDE may initially issue warnings about saving these files to the server, but you can just ignore them (delete them from the 'Problems' tab listing and they should go away).

The only files that are saved to the server are those referenced in the package.xml files.

1
  • 1
    I've found that keeping .git one level up from src works better, because I can then right-click on src and choose "Force.com->Save to Server" and not get the warnings. Deleting the initial warnings has kept them at bay, for now.
    – tomlogic
    Commented Aug 30, 2012 at 22:43
0

I used both SVN/GIT with salesforce projects. Both trouble force.com IDE a lot for the same issues you mentioned. We usually keep the repository checkout separate from the force.com IDE checkout. Developers at most work on 4-5 files at a time so they can copy it manually from IDE checkout to the GIT repository checkout.

With git, if developers just copy the src folder back to the repository it will work as well. As git doesn't creates nested .svn folders in each directory.

0

You can have Git Repository totally in different folder than current Salesforce working directory.

I am using Git successfully in almost all projects. I have also written a small article at - http://shivasoft.in/blog/salesforce/salesforce-git-eclipse-egit-better-and-distributed-source-control/

Let me know if you need more information on using Git with force.com IDE.

You must log in to answer this question.

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