docs: update git aliases description

This commit is contained in:
Wenxuan Zhang 2021-10-22 10:39:35 +08:00
parent b86dc4b0c8
commit cef385bd44
No known key found for this signature in database
GPG key ID: CCAF35548C65530F

View file

@ -123,6 +123,8 @@ For linux users `FORGIT_COPY_CMD` should be set to make copy work. Example: `FOR
#### aliases
##### shell
You can change the default aliases by defining these variables below.
(To disable all aliases, Set the `FORGIT_NO_ALIASES` flag.)
@ -142,17 +144,36 @@ forgit_rebase=grb
forgit_fixup=gfu
```
Or if you prefer, you can also use git aliases (instead of shell aliases). To do this:
1. Set the `FORGIT_STANDALONE` flag
- example: `export FORGIT_STANDALONE=1`
2. Add the bin directory in `FORGIT_INSTALL_DIR` to your `PATH`
- example: `PATH="$PATH:$FORGIT_INSTALL_DIR/bin"`
3. You can now run any forgit command as a subcommand of git!
- example: `git forgit log`
4. Add (aliases in git)[https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases]
- example: `git config --global alias.cf 'forgit checkout_file'`
5. Use the alias in git instead of the shell
- example: `git cf`
#### git
You can use git aliases by making `git-forgit` available in `$PATH`:
```sh
# after `forgit` was loaded
export PATH="$PATH:$FORGIT_INSTALL_DIR/bin"
```
*Some plugin managers can help do this.*
Then any forgit command will be a subcommand of git:
```
$ git forgit log
$ git forgit add
$ git forgit diff
```
Optionally you can add [aliases in git](https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases):
```sh
git config --global alias.cf 'forgit checkout_file'
```
And use the alias in git:
```sh
git cf
```
#### pagers