git - Squash 2 commits into 1
问题描述
I have two commits locally:
commit adae40c5e2b69a41447b08cc3dcb77003611fbbe
Author: Me
Date: Thu Mar 21 14:17:35 2019 +0000
1.0.0
commit ceaa65ea06f48dc24554a6f798aae2d668f3a43d
Author: Me
Date: Fri Feb 1 10:04:36 2019 +0000
first commit
How do I squash these so there is only one commit with the message 1.0.0
?
I tried the following but neither has worked for me:
git rebase -i HEAD~2
git rebase -i master
解决方案
For those not fond of interactive rebasing, in a situation like this it's also quite easy to just rewind and recommit :
git reset --soft HEAD~2
git commit -m "1.0.0"
推荐阅读
- javascript - cypress 错误 - cy.select() 失败,因为此元素当前已禁用
- haskell - 如何直接从命令行在 cabal v2-repl 中运行 GHCi 语句?
- angular - 角材料表在点击时突出显示一行
- r - 如何根据 R 中的第一次和最后一次观察建立病例/对照状态
- react-native - 如何为这些元素之间的垂直空间添加样式?
- c# - 使用 C#,如何将触发器和索引添加到 Oracle 数据库表?
- javascript - 使用 jQuery 替换字母
- python - Python:可以将正则表达式和组组合成单行吗?
- julia - Julia 中的分析/内存分配
- deep-learning - 深度 Q 网络中的拟合步骤