首页 > 解决方案 > 如何从文件中获取要添加到 git repo 的文件?

问题描述

我想总是将相同的文件添加到我的 git 存储库中,并且我认为将一个文件文件添加到 git 将是一种简单的方法。

如何要求git add从文件中读取要添加的文件?

标签: linuxgit

解决方案


使用标准 cli 工具也很容易做到这一点:

# bash:
git add $(cat file)

# xargs is standard on linux, and comes with git-bash on Windows :
cat file | xargs git add

推荐阅读