Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to have a simple, script-like backup solution to synchronize 2 local directories which provides a "fail-safe"-mechanism allowing to undo 1 commited unwanted modification of a file that got synchronized.


Let's say I have 2 local directories d1 and d2 initially containing the exact same files.

Is it possible to use a version control system to synchronize any changes from d1 to d2 like this:

1. a file f1 in d1 gets modified

2. d1 is synchronized to d2

3. f1 in d1 gets modified again

4. d1 is synchronized to d2 again

5. the initial version of f1 gets deleted in both directories, so that only the current and the second latest version of the file remain in both directories/repositories (an undo is possible and disk space is saved)


Also, this is on Linux (Arch).

Thank you in advance for your expertise!

share|improve this question
    
First of all, this really does belong on Superuser, there is nothing programming related in this at all. Secondly, I would suggest RSYNC for keeping directories synced. –  sosborn Aug 20 '12 at 2:24
    
RSYNC doesn't provide undo, does it? –  MCH Aug 20 '12 at 2:28
    
Not sure if this will fit your requirements, but it is a good read anyway: mikerubel.org/computers/rsync_snapshots –  sosborn Aug 20 '12 at 2:48
    
Thank you for that link! Seems like an excellent read indeed! I'm currently diving in :) –  MCH Aug 20 '12 at 2:57
    
This is on SuperUser because this is a question about using software, not building it. Git is a developer's tool, but it is not being used for development (Or, not in any way that makes that important) here. SU is the place for this question. There's plenty of knowledge on SU, however--it's not like the two communities are segregated, either. I'm not sure you want git here, anyway. rsync and copying changed files to either a third location or just a .bak or something would fit your specifications. If you need them to be always identical forever, though... why not just use a symbolic link? –  Phoshi Aug 20 '12 at 23:43
show 6 more comments

migrated from stackoverflow.com Aug 20 '12 at 14:49

This question came from our site for professional and enthusiast programmers.

1 Answer

Just set up git in your directory and remember to commit any relevant changes. You can recover earlier versions from there. To assuage lurking paraoia, set up a repository elsewhere (another machine!) to push your updates there.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.