将所有文件添加到除单个文件之外的提交? [英] Add all files to a commit except a single file?

查看:117
本文介绍了将所有文件添加到除单个文件之外的提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在变更集中有一堆文件,但我想专门忽略一个修改过的文件。看起来像 git status

I have a bunch of files in a changeset, but I want to specifically ignore a single modified file. Looks like this after git status:

# modified:   main/dontcheckmein.txt
# deleted:    main/plzcheckmein.c
# deleted:    main/plzcheckmein2.c
...

有没有一种方法可以实现 git add 但只是忽略一个我不想触摸的文本文件?例如:

Is there a way I can do git add but just ignore the one text file I don't want to touch? Something like:

git add -u -except main/dontcheckmein.txt


推荐答案

git add -u
git reset -- main/dontcheckmein.txt

这篇关于将所有文件添加到除单个文件之外的提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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