To set up your terminal so that it automatically opens each repository when launched, you can use a terminal multiplexer like tmux or GNU Screen. These tools allow you to create and manage multiple terminal sessions within a single window or tab.
Here's a general approach using tmux:
Install tmux: If you don't have tmux installed, you can install it using your package manager. For example, on Ubuntu, you can run sudo apt install tmux.
Setup terminal for first repository.
Create a new tmux session: Open your terminal and enter the command tmux new-session -s session-name, replacing "session-name" with a descriptive name for your session.
For example: tmux new-session -s java-repo-session
Navigate to java repository use the cd command to navigate to the desired repository directory.
For example: cd /path/to/repository1
Setup terminal for second repository
One can split current terminal in multiple windows to setup second repository as defined in next section. But let's explore by having separate tab for second repository.
Open a new tab in terminal and create a new tmux session for another repository.
For example: tmux new-session -s go-repo-session
Navigate to go repository use the cd command to navigate to the desired repository directory.
For example: cd /path/to/repository2
You are done with setting up terminal for multiple repositories.
How to have multiple window with in a session
For example one might want to have one window for server logs and other for git changes etc.
Split the window into panes: Within the tmux session, you can split the window horizontally or vertically into multiple panes. Use the following keybindings to split the window as desired:
Horizontal split: Ctrl+b, then %
Vertical split: Ctrl+b, then "
Navigate to each window in separate panes: In each pane, use the cd command to navigate to the desired repository directory.
For example: cd /path/to/repository1
Adjust pane sizes (optional): If you want to resize the panes, use the following keybindings:
Increase pane size: Ctrl+b, then Ctrl+arrow-key (e.g., Ctrl+b, then Ctrl+Right to increase the size of the right pane)
Decrease pane size: Ctrl+b, then Ctrl+Shift+arrow-key
How to minimise or save the session when needed without closing the session
Save the tmux session:
Detach from the tmux session without closing it by pressing Ctrl+b, then d. This will return you to your regular terminal.
When needed one can open the session again by command tmux attach-session -t java-repo-session or tmux new-session -s go-repo-session
Open the tmux session on startup [WIP]:
Edit your shell's startup file (e.g., ~/.bashrc for Bash) and add the following line at the end to automatically open the tmux session when the terminal launches: tmux attach-session -t java-repo-session || tmux new-session -s go-repo-session
Now, whenever you open your terminal, it will automatically launch the tmux session with the specified repositories in separate terminals.