这是我从assembla
提交的当我做git log
nothing to commit, working directory clean
Secret-MacBook-Air:q-sort judyngai$ git log
commit bcab1e2ea50b4ce427d64d20f748c5b64a0d08b3
Author: secret <secret@gmail.com>
Date: Sat Feb 8 19:39:01 2014 -0500
Revert "restoring t_c"
This reverts commit d95c6427869a6924358112a2b6c1d87dc29faa38.
commit cef4c538beeeec37287d57f2b78e7f89412c57e6
Author: Secret <secret@gmail.com>
Date: Sat Feb 8 19:38:51 2014 -0500
Revert "Revert "restoring t_c""
This reverts commit 3c61d17b71ae5017cf364a83c664f0b77603700b.
commit 3c61d17b71ae5017cf364a83c664f0b77603700b
Author: Secret <secret@gmail.com>
Date: Sat Feb 8 19:35:38 2014 -0500
Revert "restoring t_c"
This reverts commit d95c6427869a6924358112a2b6c1d87dc29faa38.
commit d95c6427869a6924358112a2b6c1d87dc29faa38
Author: Secret <secret@gmail.com>
Date: Sat Feb 8 19:34:44 2014 -0500
restoring t_c
Revert "moved to better traco version and added specific load path to config/init/local.rb"
This reverts commit 202ca306b0076c77748c9d3d0845506a529ab767.
commit 202ca306b0076c77748c9d3d0845506a529ab767
Author: Secret <secret@gmail.com>
Date: Sat Feb 8 18:17:40 2014 -0500
moved to better traco version and added specific load path to config/init/local.rb
commit a745f3e353d28b3170f5f30849c9ab31cf35e795
Author: Secret <secret@gmail.com>
Date: Sat Feb 8 16:00:19 2014 -0500
removed translatable_column fear clash with traco
commit 634537e267c9035b201060131ae0467f0891a233
Author: Secret <secret@gmail.com>
Date: Sat Feb 8 15:34:42 2014 -0500
downgraded traco to be compatible with 1.8.8
commit 5908ea1388d16a2665f90533405e70b1d4c343de
Author: Secret<secret@gmail.com>
Date: Sat Feb 8 15:05:48 2014 -0500
trying traco instead of translatable_column
commit 0e0db6404246fd9e239183da437e5bd0a4235ca1
Author: Secret <secret@gmail.com>
Date: Fri Feb 7 17:30:35 2014 -0500
uninstalled pg
我想永久地回到我发布的日志中的最后一次提交。我正在用新的宝石取代旧的宝石,但它没有成功。我知道有很多答案都是这样的,但每当我尝试
时git revert commit1 commit2 commit3
我最终会分开头来?
我试过了
git reset --hard committhatIwanttoreturnto
但它只是一个临时解决方案,我将支持许多提交。
我试图检查第一次提交然后恢复
做了
git revert HEAD
两次,最终还原了我的还原。因为我想我可以一个接一个地回复?
答案 0 :(得分:1)
如果您不希望在git push --force
之后reset --hard
,则只需制作一个类似于“committhatIwanttoreturnto
”的新提交,就像在“Revert multiple git commits中一样“:
确保您首先在正确的分支上(即包含那些还原提交和committhatIwanttoreturnto
的那个)
$ git checkout theRightBranch
$ git reset --hard committhatIwanttoreturnto
$ git reset --soft @{1} # (or ORIG_HEAD)
$ git commit -a
这将在您当前分支的顶部创建一个新提交,其确切内容为“committhatIwanttoreturnto
”。