gpt4 book ai didi

git - 在使用 "text"属性规范化文件后,如何强制 git check out 主分支并删除回车符?

转载 作者:IT王子 更新时间:2023-10-29 01:25:39 26 4
gpt4 key购买 nike

好的,所以我在文件 .gitattributes 中添加了这样的行

*.css text
*.js text
etc...

然后我按照 http://git-scm.com/docs/gitattributes#_checking-out_and_checking-in 中的说明进行操作

$ rm .git/index     # Remove the index to force Git to
$ git reset # re-scan the working directory
$ git status # Show files that will be normalized
$ git add -u
$ git add .gitattributes
$ git commit -m "Introduce end-of-line normalization"

但现在我的工作副本仍然有回车!我有想要保留的未跟踪文件。如何让 git checkout master 分支再次使用标准化文件?

我知道存储库中的文件已规范化,因为当我克隆存储库时,我拥有所有没有回车符的文件。

最佳答案

啊啊啊!检查之前的提交,然后检查主提交。

git checkout HEAD^
git checkout -f master

关于git - 在使用 "text"属性规范化文件后,如何强制 git check out 主分支并删除回车符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17223527/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com