いくつかの変更をステージングしたことを確認してください。それ以外の場合は、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
ます。
:: 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
これを my に追加します~/.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