Consider putting related commands together, such as push
and pull
,
to decide how to execute based on the current environment or specified parameters.
This mode is more convenient, but more difficult to implement in traditional shells such as zsh.
In nushell it's very easy.
In this way, the commands that need to be memorized will be greatly reduced, and the parameters can be automatically completed. In the most common scenarios, it is even possible to omit the parameter.
In contrast, the behavior of commands requires fine-tuning to be intuitive. (there may still be some unreasonable places that need to be adjusted)
I tried to tidy part of it, and it is basically usable. (The goal is to organize all aliases to where they should go)
Git status and stash.
Git log and show.
About the branch.
Create branch if it doesn't exist, switch otherwise (branch are automatically completed), use -d to delete.
If there is no branch as an argument, the branch is displayed.
Pull, push and other related to remote repositories
We assume that the upstream and downstream branches keep the same name and do not operate across branches.
--clone
to clone--submodule
submodule update and submodule init (with--init
)--force
push --force (assumepull --force
doesn't make sense)--init
git init--override
just used to trigger a github actions event (in fact, webhooks can also be used)--set-upstream
push --set-upstream- if branch is specified, it is
git fetch
(let's assume you don't like pulling from a different branch) - finally, if no branch and above parameters are specified
git pull
to update.- if
ahead
,git push
will be executed.
Git add, rm and restore. about files.
Use ga
because git add has the highest execution frequency,
and ga
is the most convenient input.
--delete
git rm--restore
git restore- git add
Git commit
Git diff
Git merge
Git rebase
Git cherry-pick
Git remote
Git bisect