3 points · by billconan · 10y ago · 7 comments
I often have to poke around, change few lines and rely on unit tests to figure out issues.
sometimes, changing certain lines will cause issues, I have to revert back. But I don't remember what I have changed since last time.
we use both git and perforce for source code management. but the problem is, most of the changes I want to remember are my experiments, nothing serious to create a commit or changelist.
and if I do create a changelist in the perforce, my new change will overwrite my old change, I can't see its history and revert.
one solution my friend did was using perforce as the real source code management, and creating local git repository to document local change histories. but still, you need to manually commit changes.
I want to have a simple tool that provides undo/redo/diff between revisions on a text file I specified. it shouldn't be as heavy as git or perforce, shouldn't need a server.
I can't find anything like that, I'm planning writing it myself. but before I do anything, I'd like to ask here just in case.
For example, it can be a command line tool, with the following commands:
mytool -record aaa.txt
/home/hhh/aaa.txt is recorded at rev 0
mytool -showhistory aaa.txt
/home/hhh/aaa.txt has 4 revisions
rev 1 2016/04/34
rev 2 ...
...
mytool -undo aaa.txt
revert /home/hhh/aaa.txt to rev 3
mytool -redo aaa.txt
mytool -diff 4/3 aaa.txt
(will launch an external diff tool to show the difference)
mytool -forget aaa.txt
(get rid off all histories of aaa.txt)
http://www.catb.org/~esr/src/ is another option; its billed as a modern RCS.
$ du -sch `which git`
2,0M /opt/local/bin/git
2,0M total
You don't have to push the code to a remote repository just because everybody does. An older alternative which was created to do exactly what you described is rcs[1].it means the feature set and complexity of using.
for example, I don't want to track all files under a folder. I just want to track few individual files I specified.
perhaps, I'm not a good user of git. I don't know how to do local history with git. and eventually I need to push my change to a remote repository when my experiments are done.
In any case, one could create a set of shell aliases to perform the operations needed in any way you see fit.
but it is still kinda complex.
I just want to provide redo/undo to any text file independent to any text editor.
- Saves files automatically and saves revisions
- Allows diffs between version
- Allows rollback or patches
- Include event information like unit test results or git actions at each version
I don't think this is available as a CLI tool but when you are using an IDE anyway this might me a solution for you.