如何仅提交外部文件中列出的文件名 [英] How to commit only the file names listed in an external file
本文介绍了如何仅提交外部文件中列出的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个经过大量修改的源代码树.我选择了一大堆文件,然后将其放入文件中.有办法只提交这些吗?
I have a source tree with a bunch of modifications. I selected a big list of files and put then into a file. Is there a way to commit only these ones?
我想要类似的东西
git commit --files "/tmp/files-to-commit.txt" -m "Fixed bug"
推荐答案
文件已被标记,因此不需要使用 git add 添加它们.此外,我不想删除其他标记在一起的文件,只想提交一组特定的文件.
The files was stagged already, therefore I did not need to add them using git add. Besides, I didn't want to remove other files stagged together, I just wanted to commit a specific set of files.
我是通过这种方式得到的:
I got it by this way:
git commit <first-file-of-list> -m "Fixed bug"
然后,从文件列表中删除列表的第一个文件,并使用以下命令提交其他文件:
Then, removed the first-file-of-list from file list and commit the others using:
cat /tmp/files-to-commit.txt|while read file; do
git commit $file --amend --m "Fixed bug"
done
这篇关于如何仅提交外部文件中列出的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文