Monday, June 15, 2015

Working with an experimental git branch

After several month's experience, I find it very helpful to control source code with git. I think it forces me to write small, standalone pieces of code, which is very good for reading and keeping trace of progress. However, when I am trying to write something new, I don't know what actually should be added, and the feature may not be able to work until I add several bunches of code. So these codes are experimental and may be too ugly to appear in places other than my local machine. A good way to deal with this situation is to create a separate experimental branch, adding whatever code I like. After experimenting and changing, the code becomes stable, and I can split the code in experimental branch into pieces, and rewrite them in another branch, and submit them. After that, I can remove the experimental branch as all its features have been submitted.
In one sentence, I think an experimental branch may be a good choice if the code is bigger than one commit or you are not very sure of what you want.

No comments:

Post a Comment