At last, I am getting started with Git and GitHub. For the last years, I have exclusively used Mercurial, so distributed version control is not foreign to me. I believe I have understood the basic usage of Git - branches, remotes and rebasing.
Let’s consider my workflow:
- I have the repo
- I want to work on something in a new branch
newFeature, so I create a private fork
MyName/Appand start a new branch
- At the end of the day, I have a few commits like the following, and sync it to GitHub
c2 a3 a2 c1 a1
- The next day, I will work from elsewhere, and pull and check out
- I clean things up by rebasing so that history now looks like this
- I add another commit b1 between A and C and the history now looks like this:
c12 b1 a123
- I want to sync this back to Github to continue working on it somewhere later
But what should I do?
Should I delete
MyName/App/newFeature and re-create it with what
newFeature currently looks like on my disk?
Until now, I always create yet another branch
newFeature-2 and push it there.
After a week, I am already on
newFeature-4 and I am not sure if this is the right way to do it.
With Mercurial, this was very easy and clean, as every branch was a repository by itself when it was managed as a “patch queue”. As far as I understand, there is no native equivalent of patch queues in Git.