Git – Reviewing Changes

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/git-reviewing-changes/
PINTEREST
PINTEREST
INSTAGRAM

Git stores all commits as snapshots. We can commit limitless. If we can to review our commits we can use log command.

Git Log

We can simple list commits without any argument tot the log command.

As we see there are 3 commits for the whole history of the Git repository. log command provides

  • commit hash which is used as identifier and a unique value.
  • Author is the developer info like name and email address.
  • Date is the date when the commit occurs.
  • And the last line is the message added by the developer.

List Last 2 Commits

There may be a lot of commit and if we issue log command we will get a bunch of commits. We can ffilter them with -n argument by providing limit number.

List Commits in Single Line

Listing in a more dense mode can be done with --oneline argument. This will only list commit hash and message.

List Commits Detailed

Listing detailed info about commits done with --stat command. This argument will list changing and added files.

More Details Please

To get all details about what lines are added what are diffs can be get with -p argument which means patch.

Searching in Commits

We can look for a specific developer in the commits. We need to supply --author argument with the developer name like below.

As we see that author İsmail Baydan do not exists but John Doe working and making commits for the project.

LEARN MORE  How To Get Today's Date?

Another type of search is searching messages in the commits. By providing grep argument with text we can search messages in a free text search mode.

Searching Between Dates / Time Ranges

Searching between dates can be done with before and after arguments. They can be used separetely or together like below.

As we have no commit before 2014-7-1 there is no result. All of our commits are after 2014-7-1.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/git-reviewing-changes/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)