views:

45

answers:

4

I am coding in javascript a very big file and I keep wanting to go back to a previous version because of bugs I have created in the new version. Are there any code editors that allow you to revert to a previous version of the code?

+5  A: 

I think what you need is not a specific editor. You need a version control system like Subversion or git. So you can still keep using your favourite editor.

Subversion (http://subversion.tigris.org/)

Git (http://git-scm.com/)

Prine
hmm... ok I thought of that but what I am working on isn't opensource
chromedude
You can setup your own version control repository on your local system. So it does not make your code public accessable if you dont want to.
Prine
It doesn't need to be. Sourceforge, one of the popular subversion hosting sites, is specifically for open source software. However, there are many other sites that will host a private repository, such as Beanstalk. Alternatively, you could host it on your own computer if you don't care about network access.
Christian Mann
@chromedude: SCM has nothing to do with the license or distribution of the code. It's just a way to track changes and make them easy to revert. Works just as well for proprietary code.
Chuck
ok, thanks all. I downloaded git and will try to figure out exactly how to use it. Completely new to me any advice?
chromedude
+1  A: 

This is called Version Control and is something every developer should use by default. There are many version control systems, have a look at SVN, Git, Mercurial, et al.

Some editors are integrated with a version control system, but it's always a separate system.

deceze
A: 

I very much agree with Prine's answer -- you're probably looking for version control, and many editors support it natively. However, if you're just looking for an editor that will show you changes you just made in the last few minutes, vim and emacs both have the concept of "undo trees" that let you visualize the undos and rewrites you've made in the course of a session:

Screenshot of Emacs' undo tree

Michael Mrozek
+1  A: 

Yes, both Emacs and Vim can do this:

http://www.emacswiki.org/emacs/RevisionControlSystem

http://www.vim.org/scripts/script.php?script_id=89

However, I agree with the other answers, a version control system would be more appropriate and easier to learn (assuming you don't already know Emacs or Vim).

Luke Girvin