Reputation: 2495
Here is my commits from assembla
when I do git log
nothing to commit, working directory clean
Secret-MacBook-Air:q-sort judyngai$ git log
commit bcab1e2ea50b4ce427d64d20f748c5b64a0d08b3
Author: secret <[email protected]>
Date: Sat Feb 8 19:39:01 2014 -0500
Revert "restoring t_c"
This reverts commit d95c6427869a6924358112a2b6c1d87dc29faa38.
commit cef4c538beeeec37287d57f2b78e7f89412c57e6
Author: Secret <[email protected]>
Date: Sat Feb 8 19:38:51 2014 -0500
Revert "Revert "restoring t_c""
This reverts commit 3c61d17b71ae5017cf364a83c664f0b77603700b.
commit 3c61d17b71ae5017cf364a83c664f0b77603700b
Author: Secret <[email protected]>
Date: Sat Feb 8 19:35:38 2014 -0500
Revert "restoring t_c"
This reverts commit d95c6427869a6924358112a2b6c1d87dc29faa38.
commit d95c6427869a6924358112a2b6c1d87dc29faa38
Author: Secret <[email protected]>
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 <[email protected]>
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 <[email protected]>
Date: Sat Feb 8 16:00:19 2014 -0500
removed translatable_column fear clash with traco
commit 634537e267c9035b201060131ae0467f0891a233
Author: Secret <[email protected]>
Date: Sat Feb 8 15:34:42 2014 -0500
downgraded traco to be compatible with 1.8.8
commit 5908ea1388d16a2665f90533405e70b1d4c343de
Author: Secret<[email protected]>
Date: Sat Feb 8 15:05:48 2014 -0500
trying traco instead of translatable_column
commit 0e0db6404246fd9e239183da437e5bd0a4235ca1
Author: Secret <[email protected]>
Date: Fri Feb 7 17:30:35 2014 -0500
uninstalled pg
I want to go back permanently to my last commit from the log that I posted. I was replacing an old gem with a new gem and it didn't work out. I know there has been tons of answers for something like this but whenever I tried
git revert commit1 commit2 commit3
I will end up in a detached head?
I have tried
git reset --hard committhatIwanttoreturnto
but its only a temp solution and I will be behind many commits.
I tried to checkout the first commit then revert back
did
git revert HEAD
twice and ended up reverting my reverting. because I figured I can revert one by one?
Upvotes: 1
Views: 97
Reputation: 1324268
If you don't want to git push --force
after your reset --hard
, you simply can make a new commit which will look like 'committhatIwanttoreturnto
', as in "Revert multiple git commits":
Make sure you are on the right branch first (ie the one which includes those revert commit and committhatIwanttoreturnto
)
$ git checkout theRightBranch
$ git reset --hard committhatIwanttoreturnto
$ git reset --soft @{1} # (or ORIG_HEAD)
$ git commit -a
That will create a new commit on top of your current branch which will have the exact content of 'committhatIwanttoreturnto
'.
Upvotes: 1