Find your content:

Search form

You are here

Force.com IDE warning that files in .git subdirectory only saved locally, not to server

 
Share

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 .)?


Attribution to: tomlogic

Possible Suggestion/Solution #1

** 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.


Attribution to: tomlogic

Possible Suggestion/Solution #2

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.


Attribution to: Abhinav Gupta

Possible Suggestion/Solution #3

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.


Attribution to: jordan.baucke

Possible Suggestion/Solution #4

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".

Attribution to: jejese

Possible Suggestion/Solution #5

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.


Attribution to: Jitendra Zaa
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/963

My Block Status

My Block Content