2015-12-29 12 views
7

Gitでは既にステージングされているがその後変更されたファイルのみをステージングすることは可能ですか?例えば、Gitでは、ステージングされ、修正されたファイルのみをステージングすることは可能ですか?

を与えられた:

> git status 
On branch master 
Changes to be committed: 
    (use "git reset HEAD <file>..." to unstage) 

     modified: file1 
     modified: file2 

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: file2 
     modified: file3 

file2(例えばないgit add file2または類似したもの)を指定せずにのみ、ステージfile2にGitリポジトリを伝えることが可能ですか?

答えて

7

git addを超えて見ると、あなたが行うことができます:

git update-index --again 

をドキュメントから:インデックスエントリコミットHEADからのものとは異なるパスに

実行しgit update-indexそのもの。

これは、われわれがここで必要とするものです。

+2

パーフェクト。エイリアスのもう一つ: 'restage = update-index --again' – neverendingqs

+0

@neverendingqs - そうです、それは役に立ちます:) – manojlds

関連する問題