将提交与其父级进行比较以查看对文件的更改

时间:2013-05-27 02:06:51

标签: file github git-commit git-diff git-log

当您运行git diff (specific commit)^..(specific commit)时,或者换句话说,当您将提交与其父项进行比较时,您如何知道该文件的更改内容。具体提交的更改是什么样的?

2 个答案:

答案 0 :(得分:0)

git diff的默认差异输出格式是“统一”格式。您可以在维基百科上找到description of the unified diff format

答案 1 :(得分:0)

删除的项目将以“ - ”开头,而添加的行将以“+”开头

更改通常会有一行或多行“ - ”后跟一行或多行“+”行,如此

diff --git a/app.js b/app.js
index f029ded..ce7c87d 100644
--- a/app.js
+++ b/app.js
@@ -72,9 +72,9 @@ var handlers = [
    , { path: '/logout', get: routes.logout.get }
    , { path: '/register', get: routes.register.get, post: routes.register.post }
    //, { path: '/profile/:id', get: [auth.restrict(), routes.profile.get], post: [auth.restrict(), routes.profile.post] } 
-   , { path: '/profile/:user', get: routes.profile.get} 
-   , { path: '/activity/:user', get: routes.profile.get} 
-   , { path: '/activity/:user/comments', get: routes.profile.get} 
+   , { path: '/profile/:canonical_id', get: routes.profile.get} 
+   , { path: '/activity/:canonical_id', get: routes.profile.get} 
+   , { path: '/activity/:canonical_id/comments', get: routes.profile.get} 
    //, { path: '/restricted', get: [auth.restrict(), auth.verifyCertificate, routes.login.get] }
 ];
 console.log(typeof routes.profile.get);