我不小心将一堆caching文件添加到回购。 我现在已经删除了他们,现在想要改变回购。
所以我试图做到以下几点,但似乎并不喜欢它:
git diff --name-only | grep '/cache/' | xargs git add
错误:
warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal', whose behaviour will change in Git 2.0 with respect to paths you removed. Paths like 'sym_online_app_bs3/cache/demo_cust_can_create_tickets' that are removed from your working tree are ignored with this version of Git. * 'git add --ignore-removal <pathspec>', which is the current default, ignores paths you removed from your working tree. * 'git add --all <pathspec>' will let you also record the removals. Run 'git status' to check the paths you removed from your working tree.
我不想git add --all因为还有一些其他的更改,我不想承诺。
有没有人需要做类似的事情,并有一个解决scheme。
谢谢
我在:达尔文内核版本13.4.0(Mac OSX 10.9.5)
更新
Git交互是现在可以接受的select。 但有兴趣找出如何走下这条路。
git -i
git add --all
和
git add --all <pathspec>
是不同的。
所以,
git diff --name-only | grep '/cache/' | xargs git add --all
是你想要的。 另外, git add可以在命令行上使用多个参数,所以你可以用它来完成
git add --all $(git diff --name-only | grep '/cache/' )