There is a similar question here, but I want to achieve something different: I would like to share history between sessions, but without mixing the commands that were executed in different sessions together.
For example, let's say I have two shell sessions: A and B. I type some commands in A:
A$ ls ~
A$ ls /etc
And in B:
B$ git status
B$ git log
When I type history
in a shell, I'd like to see all commands from this shell together, after commands from other shells - so that I can always use uparrrow to get last commands from the current shell. In other words, history
in shell A should show
git status
git log
ls ~
ls /etc
And in shell B it should show
ls ~
ls /etc
git status
git log
How to do this?