function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MythiliMythili 

Code overwritten when using Bitbucket repo

Hi,
I am using Eclispe with force.com IDE for developement purpose. We maintain our code version in Bitbucket. Hence I use Egit in eclipse to interact with Bitbucket and Git from Force.com IDE. When doing Git Pull operation from my remote repository(i.e from Bitbucket) the recent commits from Bitbucket gets pulled and it overrides the code in my eclispe. Because of this my code in eclipse gets overwritten. Any idea how do we handle this?
pconpcon
You should be doing your work in a seperate branch.  Then switching back to your master branch, doing a git pull and then rebasing your private branch.  Alternatively, you could stash your changes, do your pull and then pop your changes.  The seperate branch is a better way to do it.

Additional reading http://blog.deadlypenguin.com/blog/2014/07/21/using-git-with-salesforce-and-distributed-teams/
MythiliMythili
Thanks Patrick. But I am using Eclipse/Force.com IDE for my development and Egit in it for commiting my code to Git and Bitbucket. So eventhough I create a separate branch and work, when I do gitpull for my master branch the commits( and the code associated with the commits) will be pulled in and pasted in my eclipse repository.Hence they get saved in my force.com server automatically which I do not want to happen.
For the second approach you said, I can stash my changes but if some other developer has the working code in force.com server which is done after their commit, there code will get overwrittem because I pull the changes to my eclipse right?
pconpcon
I don't use the Eclipse IDE so I don't know when the deploy happens.  I think that the deploy wouldn't happen from a git pull / rebase perspective until you tell it to deploy.  There might be a setting in the plugin that determines when the deploy happens (file change vs saving vs manual push).  As for the instance of someone else working on the server, you are correct.  Unless you only deploy specfic changes then it will remove all other changes that have been deployed to the same sandbox.  This is why I would recommend that all users have their own developer sandboxes.  This way you will not be overwriting other users' work.
MythiliMythili
Okay. There is an option in eclipse called 'Work Offline'. This will not save the code to force.com server but rewrite your local workspace in eclipse and show warnings. You will have to manually open all the affected files and do refresh from server. Was trying to find out whether there is any other easy and best approach available.