git add一旦文件路径变得冗长,使用命令就会变得乏味.例如,
git add src_test/com/abc/product/server/datasource/manager/aats/DSManger.java
是否可以绕过指定绝对文件路径?可能会使用某种模式或什么?
我知道我们可以使用git gui.但是我想用cmd线来做.
提前感谢您的投入.
Ste*_*fen 50
对于类似unix的系统,您始终可以使用星号指向文件,例如
git add *DSManager.java
Run Code Online (Sandbox Code Playgroud)
将包括git可以在您当前工作目录中的源代码树中找到的所有DSManager.java文件.
enz*_*her 36
这是添加文件的另一种方法.至少在git 1.7.1中得到支持.
$ git add -i
staged unstaged path
1: unchanged +61/-61 a/very/long/path/that/we/really/dont/want/to/type.txt
2: unchanged +1/-1 another/very/long/path/that/we/really/dont/want/to/type.txt
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> 2
Run Code Online (Sandbox Code Playgroud)
按2选择更新,或键入u.
staged unstaged path
1: unchanged +61/-61 a/very/long/path/that/we/really/dont/want/to/type.txt
2: unchanged +1/-1 another/very/long/path/that/we/really/dont/want/to/type.txt
Update>> 2
Run Code Online (Sandbox Code Playgroud)
按与您要暂存的文件对应的数字.用逗号分隔多个数字,例如1,2.
staged unstaged path
1: unchanged +61/-61 a/very/long/path/that/we/really/dont/want/to/type.txt
* 2: unchanged +1/-1 another/very/long/path/that/we/really/dont/want/to/type.txt
Update>>
Run Code Online (Sandbox Code Playgroud)
按[enter]这里
updated one path
*** Commands ***
1: status 2: update 3: revert 4: add untracked
5: patch 6: diff 7: quit 8: help
What now> q
Bye.
Run Code Online (Sandbox Code Playgroud)
最后输入7或q退出.
dog*_*ane 33
使用bash,你可以设置"globstar"(shopt -s globstar),然后执行:
git add **/DSManger.java
Run Code Online (Sandbox Code Playgroud)
添加当前目录下的所有名为DSManager.java的文件.
(**/匹配所有目录和子目录.)
| 归档时间: |
|
| 查看次数: |
15071 次 |
| 最近记录: |