git查看commit的内容
来源:互联网 发布:掌门1对1 知乎 编辑:程序博客网 时间:2024/05/18 02:44
git查看commit的内容
在push之前有时候会不放心是不是忘记加某些文件,或者是不是多删了个什么东西,这时候希望能够看看上次commit都做了些什么。
一开始想到的是用gitdiff,但是gitdiff用于当前修改尚未commit的时候较为方便,一旦commit后,需要指定上次节点的名称(一个hash值),不方便。这种时候用gitlog更合适,因为commit的内容会以log来记录。
下面记录几个常用的情境以及对应的命令。
仅仅想看最近谁有提交,以及提交的描述
对应命令 gitlog
显示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.
仅仅想看最后一次的提交
对应命令参数-n1
显示Sample
commit6305aa81a265f9316b606d3564521c43f0d6c9a3
Author: XXX
Date:Thu Nov 3 11:38:15 2011 +0800
fillauthor information in the head of files and format some code
想看到最近一次提交所有更改过的文件
对应命令 gitlog -n 1 --stat
显示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
…
…
有了这几条命令,基本上对于想看最近更改的情境就可以应付过去了。最后一条并不很常用,如果有visual的工具可能更直观些。
- git查看commit的内容
- git查看commit的内容
- git查看commit的内容
- git使用点滴:如何查看commit的内容
- git diff查看本地已经commit的内容
- git查看第n个commit修改内容
- git 查看 本地仓库的commit记录
- git查看commit历史,某次commit修改内容,指定文件修改历史
- git blame 可以查看文件中的某一行内容是在哪个commit id号添加的
- git commit 仅仅对“暂存区”的内容有效
- 找回git reset中只 add,未commit的内容
- git查看某一个檔案的詳細commit record
- git 中怎样查看未传送(git push)到远程代码库的(git commit)提交?
- git 中怎样查看未传送(git push)到远程代码库的(git commit)提交?
- 删除git的commit
- git commit的常用命令
- git fetch后,查看更改的内容
- 在 github 上快速查看 commit 内容
- 开发Android小应用——短信控制的浮动窗
- log算子
- 永无止境:Google 传记
- 网站开发人员应该知道的62件事
- C#用两种方式破解号称世界上最难的问题!爱因斯坦在20世纪初出的谜语
- git查看commit的内容
- C++类模板 实现栈的链式存储结构 《数据结构》(北京科海) (部分摘抄)
- mail.alert
- 星号图函数声明版
- Oracle 10g及pro*c相关问题及解决方法
- WPF 获取屏幕分辨率(获取最大宽高)
- linux 库文件 拷贝
- js keycode列表
- file.alert - log alert to a file