Here is a simple but workable workflow for a moderate sized team
Our development workflow, while not close to a CI setup keeps all our code safely backed up, allows everyone to have the latest code and is pretty simple to implement. Which is key as we have a team filled with devs of all abilities, some of who are not familiar with git.
We have the standard git setup with a master and a develop branch. All the actions I'm going to describe below relate to the develop branch.
Every developer uses their own sandbox and pushes back to develop.
There are a lot of challenges with git and salesforce (pre Salesforce DX).
SETUP
The basic steps we use to set up a repo for the first time are:
- Set up your sandbox and download as much metadata as you intend to track.
- Delete the contents of
src
- Pull down the contents of the remote repo. See code block 1
- Pull down the contents of your org (again). Git will track the changes.
- Push back up.
Code block 1:
//get the repo ready, run 1 time to set everything up
git init
git remote add origin [email protected]:yourorg/yourproj.git
git pull origin develop
git checkout develop
DAILY WORK
- Pull from develop (and compile any changes up to your sandbox)
- Create a new feature branch
- Do work
- Commit your branch
- Pull again and merge your branch - push.
Code for this:
//start the day by pulling in others changes
git status
git pull
//used everyday, rinse & repeat after dev feature is done
git checkout -b feature/TASK-####
git status
git add ...// match to your changed files
git commit -m "fixed some stuff"
git checkout develop
git fetch
git pull
git merge feature/TASK-### //hope you don't get a merge conflict
git push
This takes care of about 90% of the stuff we need.
Of course there are merge conflicts and other issues that we periodically encounter which I'm not going to go into here... but you can avoid most of these if you pull regularly, pull often.