git status
报告
S:\mydir\AEL>git status CodingTools_SourceControl.ael
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: CodingTools_SourceControl.ael
no changes added to commit (use "git add" and/or "git commit -a")
这是改变
diff
S:\mydir\AEL>git diff CodingTools_SourceControl.ael
diff --git a/AEL/CodingTools_SourceControl.ael b/AEL/CodingTools_SourceControl.ael
index 7ae86d7..fd53caa 100644
--- a/AEL/CodingTools_SourceControl.ael
+++ b/AEL/CodingTools_SourceControl.ael
@@ -22,7 +22,7 @@ import ael
import acm
is_64_bit = True
-# Special-purpose overrides
+# Special-purpose overrides. These deliberately require minor code changes.
#CodingTools_PyLint.VERBOSE = True
#CodingTools_PyLint.PYLINTRC = "default.pylintrc"
现在我准备改变:
S:\mydir\AEL>git add CodingTools_SourceControl.ael
S:\mydir\AEL>git status CodingTools_SourceControl.ael
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: CodingTools_SourceControl.ael
如果我要一份关于阶段性变化的报告,我会看到同样的一行变化:
S:\mydir\AEL>git diff --cached CodingTools_SourceControl.ael
diff --git a/AEL/CodingTools_SourceControl.ael b/AEL/CodingTools_SourceControl.ael
index 7ae86d7..fd53caa 100644
--- a/AEL/CodingTools_SourceControl.ael
+++ b/AEL/CodingTools_SourceControl.ael
@@ -22,7 +22,7 @@ import ael
import acm
is_64_bit = True
-# Special-purpose overrides
+# Special-purpose overrides. These deliberately require minor code changes.
#CodingTools_PyLint.VERBOSE = True
#CodingTools_PyLint.PYLINTRC = "default.pylintrc"
现在我解开零钱
S:\PrimeObjects\ADSO71\KEATING\AEL>git reset CodingTools_SourceControl.ael
Unstaged changes after reset:
M AEL/ATS_SourceControl.ael
...several other unstaged changes...
我希望能够使用德威治来管理登台和提交。所以内部闲置,之后
reset
,我这样做:
>>> from dulwich.repo import Repo
>>> repo = Repo(br"S:\mydir")
>>> repo.stage([br"AEL\CodingTools_SourceControl.ael"])
git状态
S:\mydir\AEL>git status CodingTools_SourceControl.ael
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: CodingTools_SourceControl.ael
但如果我现在发布
git diff
命令,我得到一个diff报告,显示文件中所有1500多行的更改:
S:\mydir\AEL>git diff --cached --stat CodingTools_SourceControl.ael
AEL/CodingTools_SourceControl.ael | 3082 ++++++++++++++++++-------------------
1 file changed, 1541 insertions(+), 1541 deletions(-)
编辑:
在@RomainVALERI的有用评论之后,我尝试了以下命令
S:\mydir\AEL>git diff --cached --stat --ignore-cr-at-eol CodingTools_SourceControl.ael
AEL/CodingTools_SourceControl.ael | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
它报告一行发生了变化。所以这是一个行尾问题。但我需要Dulwich操作与命令行操作互换。我该怎么告诉达利奇
Repo.stage()
git add
做?
porcelain.add()
而不是
回购阶段()
porcelain.add(repo, r"S:\mydir\AEL\CodingTools_SourceControl.ael")
但没什么用。