Generally, you can check http://git-scm.com/docs/git-rebase , go to item SPLITTING COMMITS.
And better, read following thread as reference also, especially the answer gets the most votes http://stackoverflow.com/questions/1440050/how-to-split-last-commit-into-two-in-git
Play around, you will get it.
//TODO, make a example here
That is quite handy, when you forget to save you changes incrementally.
I will tell a story to show how useful it can be.
In the beginning
You write a lot of code, test, debug, finally all test case passed. What's the next thing you are going to do, usually save all the changes into a safe place, in case you would delete it by accident - or you just commit it.
But what if someone report a bug to this commit?
You don't have any idea why this issue can happen. But you want to figure out which statement cause this issue. You might revert your changes 50%, if problem still there, revert your changes 25%, otherwise 75%. With this way, you can narrow down the scope of the code which contains the bug. Without version control tool, you might save the code for (25%, 50%, 75%, 100%) into different directories. Classic! right ? And you still need to copy this changed files into your workspace, that you can build a binary.
Git save you in this case, you can split one commit into several small ones as you want. When you want to test these small commits, just 'git checkout'. Safe and clean!
Saturday, April 27, 2013
Handy GNU/Linux commands
1. Display size of directory
du -sh *
2. List files sorted by time
ls -lt
3.
du -sh *
2. List files sorted by time
ls -lt
3.
Saturday, April 20, 2013
when to create a new member to base class?
when to create a new member to base class?
Thinking the thing you are making is evolving, when you find out that some property or behavior is same as other things, it's the time.
Write code incrementally
Write code incrementally
write a bit code - -> test -> if passed - - - - - - - - - - - - - - - - - > commit->write comment->...
\ /
-> if failed->fix it->if passed -->
'A bit' is quite important, that you can find the code with problem very quickly.
When you use 'git diff', you will not get massive changes showing in the display.
My experience is that even you are working on embedded software domain, which always takes time of 10-15 mins to load the binary to your board/hardware, still it's worth to do in this way. Or we can say it's worth more than .
So, try GIT, that's absolute a tool you need on hand to commit a little bit.
Subscribe to:
Comments (Atom)