我发现将更改的文件添加到索引时写完整路径非常繁琐。例如,我更改了3个文件,但只想提交其中的2个:
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: apps/frontend/config/modules/file1
# modified: apps/frontend/config/modules/file2
# modified: apps/frontend/config/modules/file3
所以我必须输入这么多:
git add app/frontend/modules/file1 app/frontend/modules/file3
我正在寻找一种通过索引在git状态列表中添加项目的方法?类似于:
git add %1 %3
cd -
是 POSIX 中的命令。哦,你在用 csh?那么,请使用pushd
和popd
命令。 - Gilles 'SO- stop being evil'