log : One Commit per Logical Change

How Often to Commit

Since you can choose when to make a commit, you might be wondering how often to commit your changes. It's usually a good idea to keep commits small. As the diff between two versions gets bigger, it gets harder to understand and less useful. However, you don’t want to make your commits too small either. If you always save a commit every time you change a line of code, your history will be harder to read since it will have a huge number of commits over a short time period.
A good rule of thumb is to make one commit per logical change. For example, if you fixed a typo, then fixed a bug in a separate part of the file, you should use one commit for each change since they are logically separate. If you do this, each commit will have one purpose that can be easily understood. Git allows you to write a short message explaining what was changed in each commit, and that message will be more useful if each commit has a single logical change.

Commit Size Quiz

To get some practice thinking about how often to commit, on the next screen, mark whether you think the following would be good commit sizes. If not, indicate whether you think this commit is too small and you’d like to wait and commit later, or whether you think it’s too big and you would have committed earlier. This is subjective, so there aren’t any definite right or wrong answers, but just choose the answer you think is best in each case.
  • You commit all the changes required to add a new feature, which you’ve been working on for a week. You haven’t committed since you started working on it.
  • You find three typos in your README. You fix and commit the first.
  • You commit all the changes required to add a new feature, which you’ve been working on for an hour.
  • You fix two small bugs in different functions and commit them both at once.
From:
https://classroom.udacity.com/courses/ud775/lessons/2980038599/concepts/24198785820923
git log
git log --stat
git diff commitID1 commitID2
git --version
https://git-scm.com/downloads
git clone
Getting Colored Output
To get colored diff output, run git config --global color.ui auto
git checkout <> svn checkout     revert  control

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE