git - 拉取请求表明每个文件都已更改,但每个文件都没有更改
解决方案
你有没有设置类似autoctrl的东西?如果是这种情况,您可能已经更改了所有这些文件的 EOL 格式。我一定要写一篇关于这个的博客文章告诉人们不要使用它......永远......永远!!!!使用 .gitattributes 告诉 git 不要搞乱 EOL 格式:
* -text
那应该这样做....为了更正你搞砸的这个修订:
# first, make sure that you have setup .gitattributes appropriatetly
git checkout HEAD~1 -- . # got the content back of all the files as they where on the previous revision (don't worry you won't lose your work, because you already committed it, right?).
# set up .gitattributes appropriately _again_ because it was probably cleared by the previous command
# now, get the list of files that actually had something meaningful
git status -w
# the files that are listed there are the files that should have been committed before
# check them out and be ready to change their EOL to what it was on the original revision
git checkout HEAD -- file1 file2 file3
# make sure that the eol format is not busted. If you run git diff HEAD~1 you should only see the real changes that you applied, not the whole files getting cleared and then having full content readded
git add .
# now we amend the revision to how it should have been
git commit --amend --no-edit
# push -force if required
你很高兴。
推荐阅读
- python - Python 正则表达式
- python - Django Web App 在本地 Debian 10 上运行但在 Azure 上失败
- flutter - Flutter:读取 build.yaml 文件中传递给 build_runner 的变量
- javascript - 如何使用javascript根据变量的值设置随机百分比机会
- amazon-web-services - 使用 terraform 从 IAM 用户分离策略
- r - 根据条件增量创建新索引
- join - 左连接的 Hive 倾斜缓解
- windows - Windows 命令与 ADS 的交互不一致
- c++ - boost::async 读写在一次读取和两次写入后卡住
- sql - 如何从 SQL 中提取 JSON 值,其中列值有时为空