use*_*064 3 git git-add git-bash
要在Windows上使用git bash在git上提交一些东西我需要做,例如:
1.git add *
2.git commit -m "Commit test"
3.git push origin master
Run Code Online (Sandbox Code Playgroud)
通过这种方式,我提交了所有更改.我想只添加特定文件(*.h和*.cpp).解决方案是使用:
ad. 1.:
git add *.h
git add *.cpp
Run Code Online (Sandbox Code Playgroud)
但是这样我只在当前文件夹中添加*.h和*.cpp.问题是如何在一个命令中的当前文件夹和子文件夹中添加文件*.h和*.cpp?就像是:
1.git add *.h and *.cpp and_in_subfolders
and then:
2.git commit -m "Commit test"
3.git push origin master
Run Code Online (Sandbox Code Playgroud)
谢谢.
如果你使用
git add *.h
Run Code Online (Sandbox Code Playgroud)
shell将使用当前文件夹中的文件展开通配符.
Git也可以自己扩展通配符,而且它以你想要的方式(递归地)实现,所以你只需要阻止shell扩展通配符:
git add '*.h'
Run Code Online (Sandbox Code Playgroud)