gito 0.2.12

A tool to expand the ability of git
gito-0.2.12 is not a library.

中文介绍请移步

install

cargo install gito

Commands

get-upstream

alias: gup

get the parent repo ssh url based on github relationship if there is and set it as upstream remote

gito gup --remote-name [name] # default is `upstream`
gito gup # equals to `gito gup --remote-name upstream`

gito gup

user

manage git user.

it's very useful when you have a few git accounts, like one is work account and one is github account.

there're some sub-commands inspired by nrm, you can see the detail by running gito user -h.

Here we give some example

gito user add github foo foo@example.com
gito user ls

you will see an output like

+--------+-------+-----------------+
| alias  | name  | email           |
+--------+-------+-----------------+
| github | foo   | foo@example.com |
+--------+-------+-----------------+

Similiarly, you can delete and use specific account by alias

amend

as we may have different git account, sometimes we may forget to change account, so we have to run git rebase -i <commit> to amend it.

so here based on the gito user, you can amend by alias, the workflow like:

git rebase -i <commit> # choose commit need to be edit

# notice that `github` is the alias we create before
gito ammend github
# equivalent to these two commands
# git commit --amend --author 'foo <foo@example.com>' --no-edit
#git rebase --continue #

init

git init with specific user info by alias

gito init github

open

Open websites related to the current git repository. This command allows you to quickly open predefined or custom URLs in your browser.

The base_url can now include placeholders:

  • <group>: Replaced by the first part of group/name
  • <name>: Replaced by the second part of group/name

If no placeholders are used, the command will automatically append the current repository's group/name path to the base_url.

Subcommands

  • gito open ls: List all registered websites (both user-defined and default).
  • gito open add <alias> <base_url>: Add a new website alias with its base URL.
  • gito open del <alias>: Delete a user-defined website alias.

Usage Examples

Open a website using an alias:

# Opens https://deepwiki.com/foo/bar (if current repo is foo/bar)
gito open deepwiki 

Add a custom website with placeholders:

gito open add github_issues https://github.com/<group>/<name>/issues

Then open it:

# If current repo is foo/bar, opens https://github.com/foo/bar/issues
gito open github_issues

Add a custom website without placeholders:

gito open add myjira https://jira.mycompany.com/browse/

Then open it:

# Opens https://jira.mycompany.com/browse/foo/bar
gito open myjira

branch

some branch action

gito branch delete <branch_name> # delete branch both locally and remotely