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.