git使用筆記2 git diff詳解

2022-05-03 03:30:07 字數 534 閱讀 6662

例如,比較工作區和暫存區的main.cpp檔案的差異。

$ git diff main.cpp

diff --git a/main.cpp b/main.cpp

index 57a5778..24604db

100644

--- a/main.cpp

+++ b/main.cpp

@@ -1,6 +1,7

@@ #include

using

namespace

std;

intmain()

\ no newline at end of file

如上所示,原始檔是暫存區,目標檔案是工作區;

(1)--- 代表原始檔,+++代表目標檔案;

(2)@@ -1,6 +1,7 @@ 表示在原始檔第一行開始的6行和目標檔案第一行開始的7行 存在乙個差異小結;

(3)- : 代表屬於原始檔的**, + 代表屬於目標檔案的**;由上可知,工作區的**增加了一行「int a, b」(還未暫存);

git 使用筆記

git 使用筆記 初始化資訊 git config user.name name git config user.email com git config core.editor vim git init 初始化資訊 從遠端pull git clone git url git pull push 到...

git使用筆記

回滾 git checkout sql 沒有 git add 之前 執行回滾到原始狀態 git reset head sql 執行git add之後,但是沒有 git commit之前 操作,然後在執行 git checkout git remote v 檢視遠端倉庫詳細資訊 git log log...

Git使用筆記

用了一段時間的tortoisgit,基本能滿足目前的需求。但是當切換到linux的工作環境時,就有點不知所措了,於是又複習了一下git的命令,相對於第一次學習,又有了新的認識。工作區 working tree 所有有改動的檔案都存在於工作區。暫存區 index 對於已經存在於工作區的檔案,執行git...