Collection of abbreviations and interactive fish-shell integrations I use to make git
easier!
TODO create toc
- [] create command that prints all env vars regocnized by git see
man git
- fish ^3.6.0 enhanced the capabilities of
abbr
which this plugin makes use of. - git I don't hope that comes as a surprise ;-)
- sqlite3 is used to store visited git directories with the
repos
command. - gum is used to provide interactive widgets to some of the commands, like
resolve-conflicts
.
- pre-commit if installed, then the
pre-commit
reminder will be enabled.
Using fisher
fisher install kpbaks/git.fish
gbo
short for "git branch overview" list information about local branches, use --all
for local and remote, in a pretty-printed table with four columns:
branch
: The current branch is highlighted.commit
: If the commit is a a conventional-commit then thetype(scope):
part is highlighted.author
: Each author is assigned a unique color.committerdate
: Time since most recent commit. A color gradient from red to white is used to indicate how recent the latest commit was.
Here is an example of the output when run against the helix repository.
gcl
short for git config --list
lists all git config settings in a colored and formatted table. Without setting any options the user's global config will be shown. If you only want the settings for the current git repository you can use gcl [-l|--local]
gign
can be used to download common .gitignore
rules from gitignore.io
See gign --help
for more information.
TODO
TODO
TODO
repos
is a command to list and search through git repositories you have visited. It uses a sqlite3
database to store the paths of visited git directories. The database is stored at git_fish_repos_sqlite3_db
and is automatically updated when you cd
around in your shell.
repos populate <DIR> # Populate the database by recursively searching for git repositories in DIR
repos list # List all repositories in the database
repos clear # Clear the database
repos check # Update the database by removing non-existing directories
repos cd # Change directory to a repository using fzf
Tip
repos
is really useful if you create a keybind to quickly cd
around to your projects
I like to use alt-r for this:
Variable | Description | Default |
---|---|---|
git_fish_repos_sqlite3_db |
The path to the sqlite3 database file. | $__fish_user_data_dir/git.fish/repos.sqlite3 |
git_fish_repos_cd_show_preview |
Use git_fish_repos_cd_preview_command to show a preview of the repo in fzf |
1 |
git_fish_repos_cd_preview_command |
The command to use to show the fzf preview. | git -c color.status=always -C {} status |
Reminders are actions that are run when you enter a git repository. They are meant to act as helpful reminders to encourage good practices. This feature is probably not everyone's cup of tea, as it can be distracting. Therefore, all reminders are disabled by default. So you have to enable them by setting the corresponding universal variable git_fish_reminders_<reminder>_enable
to 1
.
If you have pre-commit installed then a check will be made to see if the repository has a .pre-commit-config.yaml
file.
- If it does, then the installed pre-commit hooks will be listed.
- If it does not, then a reminder will be printed to the terminal to encourage you to install - the default pre-commit hooks.
Variable | Description | Default |
---|---|---|
git_fish_reminders_pre_commit_enable |
Enable the pre-commit reminder. | 0 |
git_fish_reminders_pre_commit_list_hooks |
List the installed pre-commit hooks. | 0 |
git_fish_reminders_pre_commit_auto_install_hooks |
Automatically install the default pre-commit hooks. | 0 |
Check if there are uncommitted changes in the repository and if there are more than git_fish_reminders_should_i_commit_threshold
then a reminder will be printed to the terminal.
Example reminder with set git_fish_reminders_should_i_commit_threshold 50
:
Variable | Description | Default |
---|---|---|
git_fish_reminders_should_i_commit_enable |
Enable the should-i-commit reminder. | 0 |
git_fish_reminders_should_i_commit_threshold |
The number of uncommitted changes that will trigger the reminder. | 50 |