0

I use tmux Resurrect to keep my sessions. It works by each time that I save my sessions, they are saved into a txt file with a date stamp, and a symlink called resurrect-backup/last is pointed to the newly created file.

I've set tmux Resurrect to save the files in my dot files directory, that is a Git repo. The backup files looks like this.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        resurrect-backup/tmux_resurrect_20191211T131212.txt
        resurrect-backup/tmux_resurrect_20191212T091834.txt
        resurrect-backup/tmux_resurrect_20191212T091958.txt
        resurrect-backup/tmux_resurrect_20191216T143039.txt
        resurrect-backup/tmux_resurrect_20191217T134720.txt

I'd like the following to happen: When checking in my dot files (or at any other appropriate time), I'd like to automatically delete all tmux_resurrect_{date}.txt files, except the latest one (that resurrect-backup/last is pointing at).

The effect would be that for each commit including changes in the tmux session, one txt file gets deleted, one gets inserted, and the symlink is pointed to the newly inserted txt file.

Max
  • 488
  • 8
  • 19
  • few questions. 1. `resurrect-backup/last` is automatically created or you are creating it? 2. Why do you think there will be only one file to delete and add? Your git status itself shows more files. This can happen later on as well. You planning to commit every time your session is saved? – Vishwanath Dec 17 '19 at 15:52
  • 1. Automatically. 2. I only want to keep the latest, and if I only keep the latest always, one file will always be deleted from the repo, and another will enter. 3. I don't want to commit for every session save. – Max Dec 17 '19 at 21:01

0 Answers0