Questions tagged [undo]

Undo is a command in many computer programs. It erases the last change done to the document reverting it to an older state. In some more advanced programs such as graphic processing, undo will negate the last command done to the file being edited.

854 questions
177
votes
6 answers

How to go back (ctrl+z) in vi/vim

In normal text editors [with all due respect to Vim] there is a shortcut Ctrl+Z when you have done something nasty and want to return to the previous version of the text. Like BACK button in Word. I wonder how can you achieve this behaviour in Vim.
Slazer
  • 4,750
  • 7
  • 33
  • 60
164
votes
10 answers

Undo git mv (rename)

What is the right way to undo a rename in git, like: git mv file1 file2
jrdioko
  • 32,230
  • 28
  • 81
  • 120
158
votes
8 answers

How is the undo tree used in Vim?

This answer says: Vim's undo/redo system is unbeatable. Type something, undo, type something else, and you can still get back the first thing you typed because Vim uses an undo tree rather than a stack. In almost every other program, the history of…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
144
votes
5 answers

What is difference between 'git reset --hard HEAD~1' and 'git reset --soft HEAD~1'?

I tried to undo my commit in git. Is it dangerous to use git reset --hard HEAD~1? What is the difference between different options for git reset?
mesutali
  • 1,655
  • 2
  • 12
  • 9
141
votes
7 answers

SVN undo delete before commit

If you delete a directory from an SVN working copy, but haven't committed yet, it's not obvious how to get it back. Google even suggests "svn undo delete before commit" as a common query when you type "svn undo d", but the search results are…
LaC
  • 12,624
  • 5
  • 39
  • 38
131
votes
13 answers

Undo git reset --hard with uncommitted files in the staging area

I am trying to recover my work. I stupidly did git reset --hard, but before that I've done only get add . and didn't do git commit. Please help! Here is my log: MacBookPro:api user$ git status # On branch master # Changes to be committed: # (use…
eistrati
  • 2,314
  • 6
  • 26
  • 35
124
votes
22 answers

Design Pattern for Undo Engine

I'm writing a structural modeling tool for a civil enginering application. I have one huge model class representing the entire building, which include collections of nodes, line elements, loads, etc. which are also custom classes. I have already…
Ozgur Ozcitak
  • 10,409
  • 8
  • 46
  • 56
107
votes
4 answers

Using Vim's persistent undo?

One of the new features in Vim 7.3 is 'persistent undo', which allows for the undotree to be saved to a file when exiting a buffer. Unfortunately, I haven't quite been able to get it properly enabled, or I must be using it wrong. Here's what I've…
duckworthd
  • 14,679
  • 16
  • 53
  • 68
104
votes
10 answers

Is there a way to recover from an accidental "svn revert"?

I managed to shoot myself in the foot this morning by doing the following: Started working on a change to my project Made a bunch of edits to a bunch of files Realized that my approach was all wrong, and that I needed to start over cd'd to the top…
Jeremy Friesner
  • 70,199
  • 15
  • 131
  • 234
102
votes
3 answers

Undoing a commit in TortoiseSVN

I committed a bunch of files (dozens of files in different folders) by accident. What is the easiest, cleanest (and safest!) way to 'undo' that commit without having to delete the files from my working directory?
Manu
  • 28,753
  • 28
  • 75
  • 83
91
votes
3 answers

How to abort a merge in mercurial?

I goofed up a merge. I'd like to revert then try again. Is there a way to revert a merge before it is committed? hg revert doesn't do what I'd like, it only reverts the text of the files. Mercurial aborts my second attempt at merging and complains…
deft_code
  • 57,255
  • 29
  • 141
  • 224
86
votes
7 answers

Git pull into wrong branch

Myself and one other developer had been merging and pushing our work to a non-master branch called toolwork. That way, we didn't impact the rest of the team. My topic branch was called DPM-93 and my git workflow was this. # do some work git checkout…
milkplus
  • 33,007
  • 7
  • 30
  • 31
78
votes
1 answer

What is the difference between "Revert Commit" and "Undo Commit" in IntelliJ IDEA?

In IntelliJ Ultimate IDEA 2019.3 (not sure when it was introduced) we have "Revert Commit" and "Undo Commit" options in the Version Control -> Log Tab. What is the difference between those two options?
Marian Klühspies
  • 15,824
  • 16
  • 93
  • 136
72
votes
9 answers

DbContext discard changes without disposing

I have a desktop client application that uses modal windows to set properties for hierarchical objects. Since this is a client application and access to the DbContext is not threaded, I use a long-running context on the main Form that gets passed…
Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
68
votes
2 answers

Undo delete in GIT

I made something very stupid. I made a commit using git commit (file edits + new files) (C). Then I made amend last commit. Then I deleted all files recursively (!) using git rm -r Then I made another git commit (C). A-B-C ↑ master Is there…
Nately
  • 691
  • 1
  • 5
  • 6
1
2
3
56 57