2013-03-09 52 views
0

添加更新準備提交時,我經常使用git add -pGit add -p但新文件

但是,是否可以對新文件也做同樣的事情?它似乎並不僅限於編輯現有文件。

回答

0

命令git add用於將新文件添加到存儲庫中,並告訴Git您想要一個已更改爲下一次提交的文件。

這有很多好處,因爲git commit只會提交那些已經明確添加的文件。注意SVN add僅用於將新文件添加到回購站。

 
-p, --patch 
    Interactively choose hunks of patch between the index and the work tree and 
    add them to the index. This gives the user a chance to review the difference 
    before adding modified contents to the index.