如何在不接受所有文本更改的情况下进行git接受模式更改? [英] How do I make git accept mode changes without accepting all text changes?

查看:179
本文介绍了如何在不接受所有文本更改的情况下进行git接受模式更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从
得到了相反的问题如何让Git忽略文件模式(chmod)更改?
我有一个文件,我已经更改了可执行文件权限,但也有
文本更改,我想承诺前者而不是后者。这是
可能与git?



(其实,我已经做了一些我想提交的文本更改以及
可执行权限更改,和其他人我不想提交)



更新:取消将文本更改到文件,然后执行再次使用git add -p
,并将一些文本更改合并为模式将
更改为staging。 (我的git版本是1.5.4.3)

解决方案> git add -i 可以让你有选择地将一些文件从文件中添加到索引中。我不知道它是否对权限敏感,但是如果您要在 chmod 操作之后添加一个hunk,它可能会在索引中正确结束,即使没有明确更新权限。


I've got the opposite problem from "How do I make Git ignore file mode (chmod) changes?" I've got a file that I've changed executable permission on, but there are also some text changes, and I want to commit the former but not the latter. Is this possible with git?

(Actually, I've made some text changes I want to commit along with the executable permission change, and others I don't want to commit)

Update: Unstaging the text changes to the file, and then doing git add -p again and incorporating some of the text changes managed to get the mode change into staging. (My git version is 1.5.4.3)

解决方案

git add -i will let you selectively add some hunks from a file to the index. I don't know whether or not it's sensitive to permissions, but if you were to add a hunk after the chmod operation, it might end up in the index correctly even without explicitly updating the permission.

这篇关于如何在不接受所有文本更改的情况下进行git接受模式更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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