-
-
Save ChrisPenner/83ad2665eed3dd5fff15 to your computer and use it in GitHub Desktop.
Autoenv + tmux workflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Echo the root folder of the current git repo. | |
gitroot(){ | |
echo `git rev-parse --show-toplevel` | |
} | |
# Reconnect tmux session | |
tmuxproj(){ | |
# Don't attach to tmux if already in tmux | |
if ! { [ "$TERM" = "screen" ] || [ -n "$TMUX" ]; } then | |
# Attach to project tmux session if it exists, otherwise create it. | |
tmux attach -t `gitroot` || tmux new -s `gitroot` | |
fi | |
} | |
# inside a project's .env: | |
tmuxproj |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment