Is there a utility that streamlines the storing and restoring of bash sessions? I'd like to be able to do EG
$ KUNG=pao
$ foo commit # saves the current environment
# as an anonymous changeset from the previous savepoint
$ SCHNICKENS="What's up, doc?"
$ SCHNICKENS="$(echo Schmoove)"
$ unset KUNG
$ foo diff HEAD # outputs a $(set) of commands
# which comprise the current changeset
unset KUNG;
SCHNICKENS="Schmoove"
$ foo branch edit-su-question # creates a new branch with that name
$ foo merge master # updates the current environment
# with any changes made to ~/.bashrc
# since it was branched or last merged
$ function fierce_fist_of_foo {
cut -f 2 | xargs -I {} bash foo {} '>>' ffof.out;
}
$ foo checkout master # switches current branch
# to the one checked out by ~/.bashrc
$ foo commit -m "learned the fierce_fist_of_foo technique"
# new interactive `bash` invocations now load that function
Given its similarity to the git command-set, I'm tempted to use an obscene word, or alternatively a Smashing Pumpkins album title, as the command name in this example. But good ole foo it is.
I'm basing my faith in the workability of this concept largely on the presumption that running set from a bash shell will give you an invokable script which will restore that environment. I'm not sure if this is entirely true.
Anyway, is there something out there that works like this? Extra points if it actually uses git as part of its implementation. Like, I'll accept that answer. Since you're only in it for the points and all.