Here's our suggestion for a reliable git workflow that works well in small team settings; e.g. when using Easydata in a group setting.
If you haven't yet done so, please follow the instrucitons in our Git Configuration Guide first.
We suggest you start each day by doing this:
Sometimes, you stop work without checking things back in to the repo. Now, before you do any additional work, is the time to fix that.
git branch # what branch am I on?
git status # are there any files that need checking in?
git add -p # accept or reject parts of the modified files
git commit -m "put your commit message here"Did you make changes to your personal fork, but on a different machine? Make sure your local branch is up-to-date with your personal fork (origin):
git checkout {{cookiecutter.default_branch}}
git fetch origin --prune
git merge origin/{{cookiecutter.default_branch}}Did someone make changes to the upstream repo in your absense?
Let's fetch and merge those changes
git checkout {{cookiecutter.default_branch}}
git fetch upstream --prune
git merge upstream/{{cookiecutter.default_branch}}
git push origin {{cookiecutter.default_branch}}
make update_environmentNow that your {{cookiecutter.default_branch}} branch is up-to-date with both origin and upstream, you should use it to update your local working branches. If you are already developing in a branch called, e.g. my_branch, do this before writing any more code:
git checkout my_branch
git merge {{cookiecutter.default_branch}}
git push origin my_branchWith your local {{cookiecutter.default_branch}}, origin/{{cookiecutter.default_branch}} and upstream/{{cookiecutter.default_branch}} all in sync, we like to clean up any old branches that are fully merged (and hence, can be deleted without data loss.)
git branch --merged {{cookiecutter.default_branch}}
git branch -d <name_of_merged_branch>A really great feature of git branch -d is that it will refuse to remove a branch that hasn't been fully merged into another. Thus it's safe to use without any fear of data loss.
Once you've finished all your merge tasks, you can create a clean working branch from the latest {{cookiecutter.default_branch}} by doing a:
git checkout {{cookiecutter.default_branch}}
git checkout -b new_branch_nameThat's it! Do you have any suggestions for improvements to this workflow? Drop us a line or file an issue in our easydata issue tracker.