禁用 git 暂存区 [英] Disable git staging area
问题描述
我真的不喜欢 git 暂存区,它只会让我的生活不必要地混乱.
I really don't like the git staging area, it just makes my life unnecessarily confusing.
是否可以禁用它以便所有编辑过的文件和新文件都在一个上下文中?这样 git diff 就会显示存储库和我的工作目录之间的差异(而且我不必还输入 git diff --cached),这样 git ci 就会检查我的整个工作副本(不仅仅是上演的部分).
Is it possible to disable it so that all edited and new files are in a single context? So that git diff shows the diff between the repository and my working directory (and I don't have to also type git diff --cached) and so that git ci checks in my whole working copy (not just the part that's staged).
如果没有,替代方案(例如设置配置)以便看起来我没有分期也是很棒的.
If not, alternatives (like setting up cofigurations) so that it appears that I don't have a staging are would be great too.
我无法选择更改为不同的 DVCS,并且我不想学习喜欢暂存区.请不要发布建议这些:(
I do not have the option of changing to a different DVCS and I don't want to learn to like the staging area. Please do not post to suggest these :(
谢谢,-肖恩
PS:我在 superuser.com 上问过这个问题,https://superuser.com/questions/192022/disable-git-staging-area,但那个论坛的帖子似乎少得多(只有 118 个标记的 git 与这里的 4448 个相比)
PS: I asked this on superuser.com, https://superuser.com/questions/192022/disable-git-staging-area, but that forum seems to have much less posted (only 118 tagged git compared to 4448 here)
推荐答案
没有.你学会了爱它.
更严肃地说,git add -A;git commit
可能是你的朋友.这样,您就可以避免与暂存区的大部分互动(及其好处).
On a more serious note, git add -A; git commit
is probably your friend. That way, you avoid most of the interactions with (and benefits of) the staging area.
git add -A
比通常的 git commit -a
更强大.它将查找新文件以及暂存修改后的内容并删除不再位于工作树中的文件.
git add -A
is more powerful than the usual git commit -a
. It will find new files as well as staging modified content and removing files that are no longer in the working tree.
这篇关于禁用 git 暂存区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!