1

i find that the working of git removes the meta.xml of the apex classes. Here is what i have,

dev branch with 2 feature branches. And in the dev branch, there were 2 apex classes.So the files in the dev initially was --> E.g. user1.cls user1.cls-meta.xml & user2.cls user2.cls-meta.xml

Worked on feature1 branch, and merged to dev. Now dev have say, user1.cls and user1.cls-meta.xml (i have deleted all the other files user2.cls files which is not the part of feature1)

Then i make changes to the other 2 classes on the feature2 branch, 1 is to modify an existing class (user2.cls) and add a new class, user3.cls. while merging feature2 into dev , i have the below files left in the dev branch

user1.cls  --> intact 
user1.cls-meta.xml --> lost in the merge
user2.cls   --> modified class on feature2 branch (intact)
user2.cls-meta.xml --> lost in the merge
user3.cls   --> is the new class added (intact)
user3.cls-meta.xml --> intact

So, i lost the meta.xml of user1 and user2 classes. i think this is the right way of git but how do you guys solve this issue in salesforce development


Reason why this is right way in Git is because: * while starting dev branch have all the 4 files for the user1 and user2 class files. user1.cls
user1.cls-meta.xml user2.cls
user2.cls-meta.xml

  • created feature1 and feature2 from dev
  • on feature1 branch, i modified only the user1.cls file and deleted the files belonging to user2.cls. i left the user1.cls-meta.xml but it wasn't modified as a part of feature1.
  • merged feature1 to dev, due to this merge dev one now have what feature1 branch have.
  • on feature2 branch, i modified user2.cls and added the user3.cls and user3.cls-meta.xml
  • Merged feature2 to dev, now this is where things are happening. git thinks that the user1.cls-meta.xml was removed from feature2, so it removed it. it didn't removed the user1.cls file as it was a modified version from what feature2 had. On the feature2 branch: user2.cls-meta.xml was not modified even though user2.cls was modified. And the same file was removed from dev, so git merge think it should be removed as well.
  • Finally it keeps the new user3.cls and user3.cls-meta.xml in the dev after the merge as these are new files

I think i can checkout the file manually prior to the merge, but this will be a tedious process if the number of files is more.

  • git does not do any automatic removal of -meta.xml files. Are you by chance not committing them? If not, you probably should. – ca_peterson Jul 18 '17 at 4:13
  • 1
    @ca_peterson updated the question to be more precise – OK999 Jul 19 '17 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.