A Bash script to simplify Git working directory paths for enhanced efficiency and focus in the command line
English | 简体中文
git-short-dir-prompt
is a script designed for the Bash shell environment, based on the concept of git-prompt.sh. It displays a concise directory path within Git repositories.
It aims to enhance work efficiency and focus in the command line, especially suitable for developers who need to navigate quickly through complex directory structures.
It helps you:
Automatically detect if the current directory is a Git repository, not just initialized
Hide lengthy working directory paths in Git directories
Simplify paths to clearly point to the user and GitHub repository address
Resolved the issue of case insensitivity on Windows
- Clone the repository
git clone https://github.com/kabeep/git-short-dir-prompt.git
- Enter the project directory
cd git-short-dir-prompt
- Execute the installer
./install.sh
- Edit
.bash_profile
to call during initialization
vim ~/.bash_profile
### .bash_profile
# change your username
PS1="$PS1"'username' # username
# change your hostname
PS1="$PS1"'@hostname ' # hostname
- Load
.bash_profile
or Restart Terminal
source ~/.bash_profile
Once installed and configured, when you enter a Git repository directory, the command line prompt will automatically update to display a simplified directory path.
Contributions via Pull Requests or Issues are welcome.
This project is licensed under the MIT License. See the LICENSE file for details.