git view the content of the commit

git view the content of the commit

     Before the push , I sometimes worry about whether I forgot to add some files, or whether I deleted something more. At this time, I hope to see what the last commit has done.

The first thought was to use gitdiff , but gitdiff is more convenient when the current modification has not yet been committedcommitted , the name of the last node (a hash value) needs to be specified, which is inconvenient. In this case, it is more appropriate to use gitlog , because the content of the commitlog .

The following records several commonly used situations and corresponding commands.

Just want to see who has committed recently, and a description of the commit

Corresponding command  gitlog

Show Sample

 

commit6305aa81a265f9316b606d3564521c43f0d6c9a3 
Author:XXX 
Date:   Thu Nov 3 11:38:15 2011 +0800
    fillauthor information in the head of files and format some code
commit8e8a4a96e134dab8f045937efee35bd710006946 
Author:XXX 
Date:   Thu Nov 3 04:05:34 2011 +0800
    usermanagement 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 many errors in Milestone 1
commit2870cd564371d8ad043d0da426a5770d36412421 
Author:XXX 
Date:   Mon Oct 17 20:19:04 2011 -0400
    fixthe bug of get_ori_url_from_shorturl().
commitb6cdd881a19ecaff838d5825c3a6b7058fdd498a 
Author:XXX 
Date:   Mon Oct 17 20:17:37 2011 -0400
    fixthe bug of get_article_from_short_url.

just want to see the last commit

Corresponding command parameter -n1

Show Sample

commit6305aa81a265f9316b606d3564521c43f0d6c9a3 
Author: XXX 
Date:Thu Nov 3 11:38:15 2011 +0800
fillauthor information in the head of files and format some code

Want to see all changed files in the last commit

Corresponding command  gitlog -n 1 --stat

Show Sample

commit6305aa81a265f9316b606d3564521c43f0d6c9a3 
Author:XXX 
Date:   Thu Nov 3 11:38:15 2011 +0800
    fillauthor 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 + 
28files changed, 37 insertions(+), 8 deletions(-)

想看到最近一次提交所有更改的细节

对应命令 gitlog -n 1 -p

显示Sample

commit6305aa81a265f9316b606d3564521c43f0d6c9a3 
Author:XXX 
Date:   Thu Nov 3 11:38:15 2011 +0800
    fillauthor information in the head of files and format some code
diff--git a/Site/accounts/decorators.pyb/Site/accounts/decorators.py 
index 22522bc..a6bb440100755 
--- a/Site/accounts/decorators.py 
+++b/Site/accounts/decorators.py 
@@ -1,9 +1,9@@ 
#!/usr/bin/env python 
# -*- coding: utf-8-*- 
+# author: Rex Nov. 3, 2011 
from functoolsimport wraps 
from django.core.urlresolvers importreverse 
from django.http import HttpResponseRedirect 
-fromdjango.utils.decorators import available_attrs 
fromSite.accounts.models import UserProfile
deflogin_required(view_func): 
diff --gita/Site/accounts/forms.py b/Site/accounts/forms.py 
index016710b..778d92a 100755 
--- a/Site/accounts/forms.py 
+++b/Site/accounts/forms.py 
@@ -1,5 +1,6 @@ 
#!/usr/bin/envpython 
# -*- coding: utf-8 -*- 
+# author: Rex Nov.3, 201
http://blog.csdn.net/qxb1229/article/details/8189997
git diff --name-only --diff-filter=AMXTCR HEAD~2 HEAD | xargs -l -I{}  cp --parents --verbose "{}" target_dir 把两次提交的差异化文件拷贝出来 ​​​​

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326164793&siteId=291194637