Git usage: how to view commit content

Source: Internet
Author: User

Http://blog.rexzhao.com/category/Git

Before pushing, you may not be able to forget to add some files or delete more files. At this time, you may want to see what was done in the previous commit.

Git diff is used at first, But git diff is more convenient when it is used for the current modification that has not been committed. Once commit is completed, you need to specify the name of the last node (a hash value), which is inconvenient. In this case, it is more appropriate to use git log because the commit content will be recorded by log.

Below are several common situations and corresponding commands recorded.

 

I just want to see who has submitted it recently and the command git log corresponding to the submitted description

 

Show sample

Commit 6305aa81a265f9492b606d3564521c43f0d6c9a3
Author: XXX
Date: Thu Nov 3 11:38:15 2011 + 0800

Fill author information in the head of files and format some code

Commit 8e8a4a96e134dab8f045937efee35bd710006946
Author: XXX
Date: Thu Nov 3 04:05:34 2011 + 0800

User management is mostly complete

Details:
Add support for account disable/enable
Rewrite most related views to suit the above need
Provide two decorators for access control (see Readme)
Fixed assumerrors in milestone 1

Commit 2870cd564371d8ad043d0da1_a5770d36412421
Author: XXX
Date: Mon Oct 17 20:19:04 2011-0400

Fix the bug of get_ori_url_from_invalid URL ().

Commit b6cdd881a19ecaff838d5825c3a6b7058fdd498a
Author: XXX
Date: Mon Oct 17 20:17:37 2011-0400

Fix the bug of get_article_from_short_url.

Just want to see the corresponding Command Parameter-N 1 for the last submission

 

Show sample

Commit 6305aa81a265f9492b606d3564521c43f0d6c9a3
Author: XXX
Date: Thu Nov 3 11:38:15 2011 + 0800

Fill author information in the head of files and format some code

Git log-N 1 -- stat

 

Show sample

Commit 6305aa81a265f9492b606d3564521c43f0d6c9a3
Author: XXX
Date: Thu Nov 3 11:38:15 2011 + 0800

Fill author information in the head of files and format some code

Site/accounts/decorators. py | 2 +-
Site/accounts/forms. py | 1 +
Site/accounts/models. py | 1 +
Site/accounts/readme | 3 ++-
Site/accounts/templates/account_activate.html | 1 +
Site/accounts/templates/account_disabled.html | 1 +
...

...

28 files changed, 37 insertions (+), 8 deletions (-)

Git log-N 1-P

 

Show sample

Commit 6305aa81a265f9492b606d3564521c43f0d6c9a3
Author: XXX
Date: Thu Nov 3 11:38:15 2011 + 0800

Fill author information in the head of files and format some code

Diff -- git a/site/accounts/decorators. py B/site/accounts/decorators. py
Index 22522bc .. a6bb440 100755
--- A/site/accounts/decorators. py
++ B/site/accounts/decorators. py
@-+ @@
#! /Usr/bin/ENV Python
#-*-Coding: UTF-8 -*-
+ # Author: Rex nov. 3 and 2011
From functools import wraps
From Django. Core. urlresolvers import reverse
From Django. Http import httpresponseredirect
-From Django. utils. decorators import available_attrs
From site. Accounts. Models import USERPROFILE

Def login_required (view_func ):
Diff -- git a/site/accounts/forms. py B/site/accounts/forms. py
Index 016710b .. 778d92a 100755
--- A/site/accounts/forms. py
++ B/site/accounts/forms. py
@-+ @@
#! /Usr/bin/ENV Python
#-*-Coding: UTF-8 -*-
+ # Author: Rex nov. 3,201

...

...

with these commands, you can handle the situation that you want to view recent changes. The last one is not very commonly used. If there is a visual tool, it may be more intuitive.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.