简体   繁体   English

我如何获得每次提交的代码行

[英]How I can get line of code for each commit

4 Weeks ago, i typed "git log" in my project. 4 周前,我在我的项目中输入了“git log”。 and the result is :结果是:

commit 587b621b90ca3ba2332d252c04d3957028cbc6bc
Author: Agus Priyono <aguspriyono2012@gmail.com>
Date:   Fri Sep 28 07:56:44 2018 +0700

fixing middleware of status

 app/Http/Kernel.php                          |  3 ++-
 app/Http/Middleware/InvoiceMiddleware.php    |  3 ---
 app/Http/Middleware/MatchingMiddleware.php   |  3 ++-
 app/Http/Middleware/SeeProfileMiddleware.php | 24         ++++++++++++++++++++++++
 resources/views/admin/set-matching.blade.php |  1 -
 routes/user.php                              | 18 +++++++++---------
 6 files changed, 37 insertions(+), 15 deletions(-)

commit f997564af36a8bf700c37b298b54e6e07dd491a4
Author: Agus Priyono <aguspriyono2012@gmail.com>
Date:   Fri Sep 28 07:29:01 2018 +0700

fixing update status

 app/Http/Controllers/Admin/CheckStatusController.php |  3 ++-
 resources/views/admin/set-matching.blade.php         | 14 +++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

but now, when i type "git log", the result don't have line of code (insertions and deletions ) like this :但是现在,当我输入“git log”时,结果没有像这样的代码行(插入和删除):

commit 80c0b0c4c4100649cd5dec6df16206f63fc27f7e
Author: Dwi Yulianto <trafalgarlaw.dwi@gmail.com>
Date:   Fri Nov 2 10:55:11 2018 +0700

update again

commit f39df6add36d91373ba13b29039a5d576d7554d8
Author: Dwi Yulianto <trafalgarlaw.dwi@gmail.com>
Date:   Fri Nov 2 10:31:11 2018 +0700

update tody

commit 4bd1372236982c0e0db8921c8d96dae2dd3ef677
Author: Dwi Yulianto <trafalgarlaw.dwi@gmail.com>
Date:   Wed Oct 31 16:10:16 2018 +0700

add blank

how I can get the line of code for each commit?我如何获得每次提交的代码行? thank you.谢谢你。

Try first:先试试:

git log --compact-summary

That should give you back the type of log format you were seeing.这应该会返回您所看到的日志格式类型。

git log --compact-summary : git log --compact-summary

Output a condensed summary of extended header information such as file creations or deletions ("new" or "gone", optionally " +l " if it's a symlink) and mode changes ("+x" or "-x" for adding or removing executable bit respectively) in diffstat.输出扩展头信息的精简摘要,例如文件创建或删除(“new”或“gone”,如果是符号链接,则可选“ +l ”)和模式更改(“+x”或“-x”用于添加或删除diffstat 中的可执行位)。
The information is put between the filename part and the graph part.信息放在文件名部分和图形部分之间。
Implies --stat .暗示--stat

Note that it is fairly recent : Git 2.17+ (Q2 2018).请注意,它是最近的:Git 2.17+(2018 年第二季度)。
So check your Git version.因此,请检查您的 Git 版本。

As commented, git log --stat is similar (and older)正如所评论的, git log --stat是相似的(并且更旧)

Try git diff.试试 git diff。 Much cleaner and elegant way of getting the same information:获取相同信息的更简洁优雅的方式:

HarshMacBookPro:TitanAdserver harshprateek$ git diff
diff --git a/app.py b/app.py
index 2a93c2f..742ba79 100755
--- a/app.py
+++ b/app.py
@@ -52,6 +52,8 @@ class User(db.Model):
     username = db.Column(db.String(32), index=True)
     password_hash = db.Column(db.String(64))
     role = db.Column(db.String(32))
+    address = db.Column(db.String(128))
+    country = db.Column(db.String(128))

     def hash_password(self, password):
         self.password_hash = pwd_context.encrypt(password)
@@ -119,6 +121,11 @@ def addFeed():
     status = routes.addFeedToDB(request)
     return status

+@app.route('/api/v1/createPublisherFeed')
+def createPublisherFeed():
+    status = routes.createPublisherFeed(request)
+    return status
+
 @app.route('/api/v1/users/<int:id>')
 def get_user(id):
     user = User.query.get(id)
@@ -304,7 +311,7 @@ def addPublisher():
 @app.route('/viewPublishers')
 #@login_required
 def viewPublishers():
-    json_feeds = mongo_db.feeds.find()
+    json_feeds = mongo_db.publisher_details.find()
     return render_template('viewpublishers.html',feeds=json_feeds)   

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我怎样才能在 git 中获取文件的每次提交的代码行 - How can i get the line of code per commit for a file in git 如何获取 git 日志以在一行上打印每个提交的完整 hash 和简短统计信息? - How can I get git log to print the full hash and short stats of each commit on one line? 如何为github中的每个提交提取与文件相关的代码? - How can i extract code related to files for each commit in github? 如何获得文件所有权,即每个开发人员为应用程序的每次提交添加的代码行 - How to get file ownership i.e lines of code added by each developer per commit for an application 如何找到提交历史记录中存在特定代码行的文件? - How can I find the file that a particular line of code existed within in my commit history? 我如何从git压缩的提交中获取最后的提交 - How can i get the last commit from squashed commit in git 如何在错误提交之前立即获取提交的哈希值? - How can I get the hash of a commit immediately before a faulty commit? 我如何获得分支中每个提交的差异 - how do I get a diff of each commit in a branch 疑难解答:如何让 Git 在提交时使用 VS Code? - Troubleshooting: How can I get Git to use VS Code when making a commit? 如何在存储库中签署每个(甚至是旧的)提交? - How can I sign each (even old) commit in the repository?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM