Questions tagged [revert]

Revert generally refers to operations that put a system, environment, or application into a previous state.

Revert generally refers to operations that put a system, environment, or application into a previous state.

559 questions
2552
votes
19 answers

How do I revert all local changes in Git managed project to previous state?

I ran git status which told me everything was up to date and there were no local changes. Then I made several consecutive changes and realized I wanted to throw everything away and get back to my original state. Will this command do it for me? git…
Jacques René Mesrine
  • 46,127
  • 27
  • 66
  • 104
814
votes
14 answers

How do I "un-revert" a reverted Git commit?

Given a change that has been committed using commit, and then reverted using revert, what is the best way to then undo that revert? Ideally, this should be done with a new commit, so as to not re-write history.
JimmidyJoo
  • 10,503
  • 7
  • 27
  • 30
798
votes
5 answers

How can I revert a single file to a previous version?

Is there a way to go through different commits on a file. Say I modified a file 5 times and I want to go back to change 2, after I already committed and pushed to a repository. In my understanding the only way is to keep many branches, have I got…
georgeliquor
  • 8,023
  • 3
  • 16
  • 4
456
votes
16 answers

Remove specific commit

I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been…
Joshua Cheek
  • 30,436
  • 16
  • 74
  • 83
345
votes
14 answers

How do I revert an SVN commit?

I have found various examples of how to revert an SVN commit like svn merge -r [current_version]:[previous_version] [repository_url] or svn merge -c -[R] . But neither of them seems to work. I tried those commands and checked the files that were…
Alex
  • 41,580
  • 88
  • 260
  • 469
310
votes
3 answers

git revert back to certain commit

how do i revert all my files on my local copy back to a certain commit? commit 4a155e5b3b4548f5f8139b5210b9bb477fa549de Author: John Doe Date: Thu Jul 21 20:51:38 2011 -0500 This is the commit i'd like to revert back to.…
David
  • 10,418
  • 17
  • 72
  • 122
258
votes
25 answers

git status shows modifications, git checkout -- doesn't remove them

I would like to remove all changes to my working copy. Running git status shows files modified. Nothing I do seems to remove these modifications. E.g.: rbellamy@PROMETHEUS /d/Development/rhino-etl (master) $ git status # On branch master # Changed…
rbellamy
  • 5,683
  • 6
  • 38
  • 48
254
votes
7 answers

Mercurial — revert back to old version and continue from there

I'm using Mercurial locally for a project (it's the only repo there's no pushing/pulling to/from anywhere else). To date it's got a linear history. However, the current thing I'm working on I've now realized is a terrible approach and I want to go…
Paolo
  • 22,188
  • 6
  • 42
  • 49
215
votes
8 answers

Revert changes to a file in a commit

I want to revert changes made by a particular commit to a given file only. Can I use git revert command for that? Any other simple way to do it?
lprsd
  • 84,407
  • 47
  • 135
  • 168
204
votes
6 answers

Git undo changes in some files

While coding I added print statements into some files to keep track of what was going on. When I am done, is it possible to revert changes in some files, but commit the file I actually worked on? Say I added print in file A, but I modified file B.…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
201
votes
13 answers

Reverting single file in SVN to a particular revision

I have a file as shown below in an SVN repo that I would like to revert to a previous version. What is the way to do this in SVN? I want only downgrade this particular file to an older version, not the whole repo. Thanks. $ svn log…
Gökhan Sever
  • 8,004
  • 13
  • 36
  • 38
193
votes
4 answers

Revert a range of commits in git

How can I revert a range of commits in git? From looking at the gitrevisions documentation, I cannot see how to specify the range I need. For example: A -> B -> C -> D -> E -> HEAD I want to do the equivalent of: git revert B-D where the result…
Alex Spurling
  • 54,094
  • 23
  • 70
  • 76
158
votes
24 answers

Can't seem to discard changes in Git

After seeing the following from the command line: # On branch RB_3.0.10 # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # …
gemini929
128
votes
5 answers

How do you revert to a specific tag in Git?

I know how to revert to older commits in a Git branch, but how do I revert back to a branch's state dictated by a tag? I envision something like this: git revert -bytag "Version 1.0 Revision 1.5" Is this possible?
zachd1_618
  • 4,210
  • 6
  • 34
  • 47
108
votes
15 answers

Git: How to revert 2 files that are stubbornly stuck at "Changed but not committed"?

I have a repo that has two files that supposedly I changed locally. So I'm stuck with this: $ git status # On branch master # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout --…
Greg Hendershott
  • 16,100
  • 6
  • 36
  • 53
1
2 3
37 38