確保您已經進行了一些更改。否則,git commit -v
會顯示與您發佈的內容類似的內容,但不會執行任何操作。您可以使用git add
手動分階段進行更改,或者如果這些文件已經過版本控制,則可以使用git commit -a -v
分階段並提交更改。
例如:
$ echo "more foo" >> foo.txt
$ git commit -v
# 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: foo.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
舞臺的變化顯示了git commit -v
的DIFF:
:: git add foo.txt
:: GIT_EDITOR=cat git commit -v
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: foo.txt
#
diff --git a/foo.txt b/foo.txt
index 257cc56..a521556 100644
--- a/foo.txt
+++ b/foo.txt
@@ -1 +1,2 @@
foo
+more foo
Aborting commit due to empty commit message.
如果你只是想看到的差異而不提交,使用git diff
看不分階段的變化,git diff --cached
到查看爲提交進行的更改,或git diff HEAD
以查看工作樹中的暫存和未暫存更改。
UPDATE:給出你的編輯,你真正想要的是git diff
以上的衍生產品。我不確定Aptana Studio如何工作。它可能不遵循典型的命令行git流程。在命令行上,您可以進行更改,然後進行提交。上面的git diff
命令是您用來檢查這些更改的命令。我通常爲git unstaged
,git staged
,並git both
加入這個我~/.gitconfig
別名他們:
[alias]
# show difference between working tree and the index
unstaged = diff
# show difference between the HEAD and the index
staged = diff --cached
# show staged and unstaged changes (what would be committed with "git commit -a")
both = diff HEAD
+1是的。 'git diff .htaccess'做我想達到的。謝謝 :) – Houman