社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

理解Git Diff

N08 • 5 年前 • 1796 次点击  

我的报告中有一个文件“file.txt”,其中包含三行:

1
2
3

此文件已提交。但是,如果我现在向文件中添加第四行,则如下所示:

1
2
3
4

当我输入“git diff file.txt”时,它会给出以下输出:

diff --git a/file.txt b/file.txt
index 5f5fbe7..b178657 100644
--- a/file.txt
+++ b/file.txt
@@ -1,3 +1,4 @@
 1
 2
-3
\ No newline at end of file
+3
+4
\ No newline at end of file

换句话说,在第1行,根据git diff,删除了三行,添加了4行。( @@ -1,3 +1,4 @@ )这对我来说没有意义,因为我所做的只是添加第四行-所以我希望输出( -0,0 +4,1 )

这里发生了什么?


我在Windows7上运行Git。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/38741
 
1796 次点击  
文章 [ 3 ]  |  最新文章 5 年前