1

I started a git revert on a fairly long sequence of commits, not knowing about the -no-edit option. So each commit being reverted pops up the editor. Quitting the editor without saving "aborts" the revert, but only for the particular commit being reverted - so as soon as it exits git pops up another edit window for the next commit in the sequence being reverted.

The man page on the web shows an option --abort that does what I want, but I tried using it (in a different window), and get the usage message:

$ git revert --abort live-20121111..V2.1-master
usage: git revert [options] <commit-ish>

I'm using Cygwin git version 1.7.5.1, so presumably the --abort option was introduced in a newer version. How can I cleanly stop the whole sequence to start over with the --no-edit option? I don't want to have to quit hundreds of editor sessions.

sootsnoot
  • 2,178
  • 3
  • 22
  • 27

1 Answers1

1

The manual revert --abort can be replaced by a git reset --hard. This will have the effect of stopping the loop albeit with errors complaining that refs/heads for the branch is not at the commit expected when you quit the editor.

Do a git log (to check what commit were already generated by the git revert), and select the SHA1 of the commit you want to reset to.

That being said, using git in Cygwin could be avoided, using the very latest (4 days ago) Git for Windows 2.4.5.
The PortableGit-2.4.5.1-4th-release-candidate-64-bit.7z.exe can be extracted anywhere you want, and comes with a git-bash.exe which opens a fairly recent and complete bash.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @sootsnoot what I am saying is that, if you are using Git 2.4.5, you will have access to the `--no-edit` option of the `git revert`. No need for Cygwin. – VonC Jul 02 '15 at 13:46
  • @sootsnoot the `reset --hard` is just to abort the current `git revert` as a whole. But to restart the `git revert`, I would recommend using Git 2.5.4 (for Windows) – VonC Jul 02 '15 at 13:50
  • Oh, okay. Actually, 1.7.5.1 does have the --no-edit option, I just wasn't aware of it (or the need for it as I had never done a revert before). As I said in the original question, I just want to stop the loop that keeps popping up the editor for each commit being reverted, so I can start over with --no-edit. I know the commit I want to start from and know how to use reset --hard to get there. – sootsnoot Jul 02 '15 at 14:04
  • @sootsnoot Cygwin is fine. Cygwin for using Git is not so fine (slow and outdated). You also have a 32-bits version of Git for Windows (https://github.com/git-for-windows/git/releases/download/v2.4.5.windows.1/PortableGit-2.4.5.1-4th-release-candidate-32-bit.7z.exe). Using the bash coming with that Git distro doesn't prevent you to use Cygwin for everything else. I personally don't use Cygwin: I have a VirtualBox (on Xp or Win7) on which I run a full Ubuntu or Mint distro, or boot2docker for quick Linux containers. – VonC Jul 02 '15 at 14:04