git - 第一次提交的更改(不更改日期)
问题描述
我想向我的存储库中的第一个提交添加更改。我做了以下命令:
git tag root `git rev-list HEAD | tail -1`
git checkout -b new-root root
// changes in code
git add .
GIT_COMMITTER_DATE="Mon Oct 1 22:36:58 2018 +0200"
git commit --amend --no-edit --date="Mon Oct 1 22:36:58 2018 +0200"
git checkout @{-1}
git rebase --onto new-root root --committer-date-is-author-date
git branch -d new-root
git tag -d root
git push origin master --force
一切正常,除了在文件列表(GitLab)中,那些未被任何提交修改的文件的日期更新为新的:
谁能告诉我如何改进它?提前谢谢你!
解决方案
为了确保您的最后一个参数不会被忽略,您可以重复您的序列:
git rebase --committer-date-is-author-date --onto new-root root
# instead of
git rebase --onto new-root root --committer-date-is-author-date
您需要先使用或恢复root
分支。git reflog
git reset --hard ORIG_HEAD
然后在 rebase 之前和之后首先检查根分支的作者/提交者日期:
git log --graph --pretty=format:"%aD --- %cD" root
推荐阅读
- mongodb - 聚合得到一个计数列表
- r - 使用 dplyr/rollapply 按组滚动百分比变化
- javascript - 为什么我的中心对角线图像的底部边缘较暗?
- flutter - 如何调试“'.. Flutter 的实例”
- javascript - graphicsmagick透明不工作?
- c - 使用 -Ofast 使用密码学编译程序是否安全?
- java - Spring Cloud Contracts 可以处理具有不同返回 http 状态码的重复请求吗?
- r - 使用ggplot2在直方图上的密度
- pandas - 如何在 matplotlib 中显示 x 和 y 轴上的所有标签
- flutter - CORS 颤动网络