日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

git 如何提取已提交的文件_git取两次提交的文件列表,包含目录信息

發布時間:2025/3/15 编程问答 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 git 如何提取已提交的文件_git取两次提交的文件列表,包含目录信息 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.用git rev-list HEAD取得版本號列表:

在SmartGit中看到的也是這樣,驗證了我們的猜想:

取到兩個版本號之后,用git diff命令:git diff?[--options] ... [--] […?]

這里的[-options]我們填的是--name-status,指的是版本號,也就是每次版本的散列值,可以填前幾位就可以了,git會自動識別。

--name-status選項,可以輸出每個修改的文件的狀態,添加,修改,刪除還是重命名等。

輸入命令git diff --help可以查看幫助文檔:

--name-status

Show only names and status of changed files. See the description of the--diff-filter option on what the status letters mean.

--diff-filter=[(A|C|D|M|R|T|U|X|B)…?[*]]

Select only files that are Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R), have their type (i.e. regular file, symlink, submodule, …?) changed (T), are Unmerged (U), are Unknown (X), or have had their pairing Broken (B). Any combination of the filter characters (including none) can be used. When* (All-or-none) is added to the combination, all paths are selected if there is any file that matches other criteria in the comparison; if there is no file that matches other criteria, nothing isselected.

Also, these upper-case letters can be downcased to exclude. E.g. --diff-filter=ad excludes added and deleted paths.

其中M和1.txt之間是\t,后面的是目錄和文件,如果是在ubuntu下的話,比如修改了文件夾aa下的my.txt

則:

M\taa/my.txt

因為linux上的文件夾目錄都是/,windows的,沒有測試有需要的可以測試。

如何要輸出到文件中:

//>> 后加輸出文件的路徑、文件名和后綴名

git diff [branchA] [branchB] >>d:/diff/exportname.diff

linux的重定向命令

覆蓋 git diff [branchA] [branchB]>a.txt

追加 git diff [branchA] [branchB]>> a.txt

命令的具體參考幫助文檔:git diff --help

用git show命令也可以:

git show會在下面包含每個文件的對比信息(內容),這將會是大量字符串。

具體如果有目錄下的文件不能顯示區別,則兩個命令的差異實踐幾次就會發現,可以解決問題的。

總結

以上是生活随笔為你收集整理的git 如何提取已提交的文件_git取两次提交的文件列表,包含目录信息的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。