Git-在命令行中添加文件的有效方法 [英] Git - efficient way to add files in commandline

查看:36
本文介绍了Git-在命令行中添加文件的有效方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更喜欢使用Git命令行,感觉就像我知道自己在做什么(否则,我只能怪自己...).

I prefer using my Git commandline, feels like I know what I am doing (or if not, I can only blame myself...).

还是,总是觉得 git add -ing文件是效率最低的事情.

Still, it always feels like git add-ing files is the least efficient thing to do.

我不喜欢 -a 选项,尤其是当我真的不想添加所有文件时.我确实喜欢 -i 功能,该功能使我可以通过键入数字(或仅添加摘要)来添加所有文件.

I do not like the -a option, especially when I really do not mean to add all files. I do like the -i feature that allows me to add all files just by typing numbers (or just add snippets).

但是,仅添加四个文件就很麻烦-必须 git status ,然后复制/粘贴等...

But just adding let's say four files feels like a pain - have to git status, then copy/paste etc...

Ayn提示?更好的工作流程?

Ayn tips? better workflow?

推荐答案

您可以使用 globs 模式,这是shell的扩展,而不是git本身.

You can add files using globs pattern this is extension of shell but not the git itself.

例如,如果您拥有

src/files-I-want-to-commit/file1
src/files-I-want-to-commit/file2
src/files-I-want-to-commit/file3
src/files-I-Dont-want-to-commit/file

您可以轻松完成

git add src/files-I-want-to-commit/

如果您有:

src/files-I-want-to-commit/commit_file1
src/files-I-want-to-commit/oh-I-dont-want-to-commit-that
src/files-I-want-to-commit/and-that

您可以执行以下操作:

git add src/files-I-want-to-commit/commit_*

以此类推.

这篇关于Git-在命令行中添加文件的有效方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆