2015/07/17

How to use git to do development #2

Recall

Last time I have shown you my configurations. This time I am going to share my visions about git merge and git rebase.

What is merge and what is rebase?

If you are confused about these 2 operations, I suggest you to go through slides here.
For merge, it adds a node (commit) in order to join two parallel branches (with a parent node some where).
For rebase, it moves one of the parallel branches onto another one. “NO” new nodes will be added during this operation.

Workflow?

By workflows, I mean how you tactic and regulate branches in your project. For example, master is a production branch while hotfix are branches that branched off from master. Those hotfix branches must be merged or rebased eventually etc.
The concept of workflow is a kind of regulations or agreements between developers.
IMHO, you do not need this if you are one man band :) Do whatever you like.
If you are not sure which one to start, I suggest you to go through this one first. Even you do not agree with the writer, he gives you hints for modeling your workflow with git.

So, which workflow I have adopted?

Actually, I am a fans of terminal. I would like to keep all my history as linear as possible which is easier for me to read. Therefore, I will embrace git rebase instead of git merge.
However, this does not means I do not git merge at all. Since result of git merge and git rebase are the same eventually, I will use git merge if I am running out of time.
Alternatively, if you are good at using GUI tools like SourceTree, go for git merge instead of git rebase since those GUI is able to tell you commits coming from which branch.