I still work more often in Subversion than I do in git, and the commands aren’t quite under my fingers yet. So, more for my memory than anything else, here’s my current git workflow for when I’m working on my own stuff.
First, I create a local version of the repository to work on.
1
| |
Next, I’m going to create a branch for whatever it is I’m working on at the moment. I tend to be a bit of a splitter when it comes to branches. One change, feature or fix, per branch. Git is great for that.
1
| |
After that, I do a small change at a time. Lots and lots of small commits. Loop over this as many times as you need.
1
| |
When I’ve finished everything and it’s time to check my code back in, I checkout my master branch and make sure that I’ve got the latest commit.
1
| |
At that point, I’m ready to merge my new code into the master branch, run all of my tests, and push everything back up to the origin.
1
| |
When I’m done, I usually just trash the branch I’ve been working on.
1
| |
Please note, I generally work by myself and I’m not too worried about conflicting merges and the like. This workflow would obviously have to be modified to handle that.