I would like some feedback on my git workflow because this is my first use of it and despite reading various articles and Stack Overflow questions, I'm not sure that my process is correct. This is my current workflow (note that I am using the Github for Windows application for all of my git interactions):
- Decide what the next feature is that I'm going to implement.
- Create a branch with a suitably descriptive name for the feature. I do this by clicking on the branch button in Github for Windows and typing a new name.
- Write some code.
- Commit those changes to my new branch.
- Write some more code.
- Commit those changes to my new branch.
- I've finished implementing the feature so I want to merge my changes back to the master branch. So I click on the 'manage' button underneath the branch heading.
- Merge the new branch into the master branch.
- Delete the new branch.
I am quite happy with the process up until step 7 at which point I am a little confused. I think my confusion lies in the fact that I'm trying to use the Github for Windows application rather than using the command line. The application does seem to make things easier but there is a bit of a disconnect in my understanding between some of the commands/instructions I see mentioned and the actions you would take in the application.
Let me ask some specific questions:
- Is my workflow actually correct? If not, what is wrong with it and how can I improve it?
- Should I be "publishing" my changes to the new branch? My understanding is that this is the equivalent of doing
git push
at the command line. Is that true? If so I think I would only want to do that when I am either finished implementing the feature or it is in a decent state? - Should I be deleting the branch when I have merged it into the master branch or should it be left around forever?
- Do I need to publish the master branch when I have completed the merge or is this implicit?
- I am sometimes unable to perform the merge and get this error message:
Unable to merge
Failed to merge 'test' into 'master'. You might need to open a shell and debug the state of this repo.
When this occurred before, I was able to change to the master branch and merge the new branch into the master branch however that no longer works. No matter which branch I am in, I cannot merge the two branches. Both are in sync and I've published all the changes from my test branch. What should I be typing in the shell to find out why I can't merge the branches?
For reference, these are the main links that have prompted my process: