An open API service indexing awesome lists of open source software.

https://github.com/alicederyn/gittools

CLI tools to get more out of git
https://github.com/alicederyn/gittools

git

Last synced: 8 months ago
JSON representation

CLI tools to get more out of git

Awesome Lists containing this project

README

          

Alice's git tools
=================

This project contains a set of git CLI tools maintained by [alicederyn]. The most stable is `git graph-branch`, which displays a clean tree of your local git repository's branches, including forks and merges, whether the branch is in sync with origin (GitHub only), and whether tests are currently passing in CI.

[alicederyn]: https://github.com/alicederyn

To install the tools, use [pipx]:

```bash
pip install pipx
export PATH="$PATH:$HOME/.local/bin"
pipx install git+https://github.com/alicederyn/gittools.git
```

[pipx]: https://pipxproject.github.io/pipx/

* [git graph-branch](#git-graph-branch)
* [git pr](#git-pr)

git graph-branch
----------------

Usage: git graph-branch [options]

Symbols:
πŸ”· This branch is in sync with a remote of the same name
πŸ”Ά This branch is out of sync with a remote of the same name
βŒ› A CI build is in progress for this branch
πŸ’š A CI build has succeeded for this branch
πŸ”₯ A CI build has failed for this branch

Options:
-h --help Show this screen.
-w, --watch Continue to watch for git repo changes after printing the graph.
--profile Profiles the app.
-l, --local Only display information available from the local git repo.
Continuous integration results will not be fetched.

This tool is optimized for [the Hack font](https://github.com/source-foundry/Hack), and may not look as good with other font choices.

To get the best out of git graph-branch, I recommend a few configuration changes to your git checkout (`/path/to/repo/.git/config`, or `~/.gitconfig` if you would like to make these changes to every checkout); these will also give you better defaults for several git commands.

[branch]
autosetupmerge = always # sets upstream information when you run git checkout -b
[remote]
pushdefault = origin # plain git push will continue to work as expected
[gc]
auto = 100000 # keeps branch history for longer
[pull]
rebase = true # git graph-branch assumes you always rebase remote changes
[push]
default = simple # plain git push will continue to work as expected

If you have not used these defaults before, you may want to set up upstream information for your existing branches as a one-off. For instance, if `feature/foo` is going to be applied to `develop`, run `git branch feature/foo --set-upstream-to=develop`. Once you have made the config changes above, `git checkout -b feature/foo` will set this upstream information for you when you create the branch.

git graph-branch will then use this upstream information to determine a tree structure for your branches. For instance, you might see something like:

─ cleanup/immutables πŸ”· πŸ”₯
┬ feature/java.8
β”Ό feature/herc.strategy.api.plugin πŸ”· πŸ’š
β”Ό feature/no.more.internal.cluster.dispatch.connection πŸ”· πŸ’š
β”œβ–Άβ•΄ feature/distTar-unbreakable πŸ”· πŸ’š
β”΄ develop πŸ”Ά πŸ’š β‘‘ unmerged
─ workspace

In this case, `feature/java.8` is branched off `feature/herc.strategy.api.plugin`, which is branched off `feature/no.more.internal.cluster.dispatch.connection`, which itself is branched off of `develop` (and all four are passing CI tests!).

git pr
------

(Mac only)

Opens the browser to a GitHub page for creating a new PR for this branch, using upstream as the target branch.