git-revert

Rollback to an old Git commit in a public repo

僤鯓⒐⒋嵵緔 提交于 2019-11-26 01:55:09
问题 How can I go about rolling back to a specific commit in git? The best answer someone could give me was to use git revert X times until I reach the desired commit. So let\'s say I want to revert back to a commit that\'s 20 commits old, I\'d have to run it 20 times. Is there an easier way to do this? I can\'t use reset because this repository is public. 回答1: Try this: git checkout [revision] . where [revision] is the commit hash (for example: 12345678901234567890123456789012345678ab ). Don't

Re-doing a reverted merge in Git

◇◆丶佛笑我妖孽 提交于 2019-11-26 01:27:40
问题 I have run into a bit of a problem here: I had a problem-specific branch 28s in Git, that I merged in the general develop branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge 28s into develop , but git-merge command sees the original merge, and happily announces that all is well and branches have been already merged. What do I do now? Create a \'Revert \"Revert \"28s -> develop\"\" \' commit? Doesn\'t seem to be a good way

How to move HEAD back to a previous location? (Detached head) & Undo commits

荒凉一梦 提交于 2019-11-25 22:13:45
问题 In git, I was trying to do a squash commit by merging in another branch and then resetting HEAD to the previous place via: git reset origin/master But I need to step out of this. How can I move HEAD back to the previous location? I have the SHA1 frag ( 23b6772 ) of the commit that I need to move it to. How can I get back to this commit? 回答1: Before answering let's add some background, explaining what is this HEAD . First of all what is HEAD? HEAD is simply a reference to the current commit

How do I revert a Git repository to a previous commit?

删除回忆录丶 提交于 2019-11-25 21:34:41
问题 How do I revert from my current state to a snapshot made on a certain commit? If I do git log , then I get the following output: $ git log commit a867b4af366350be2e7c21b8de9cc6504678a61b` Author: Me <me@me.com> Date: Thu Nov 4 18:59:41 2010 -0400 blah blah blah... commit 25eee4caef46ae64aa08e8ab3f988bc917ee1ce4 Author: Me <me@me.com> Date: Thu Nov 4 05:13:39 2010 -0400 more blah blah blah... commit 0766c053c0ea2035e90f504928f8df3c9363b8bd Author: Me <me@me.com> Date: Thu Nov 4 00:55:06 2010