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

https://github.com/djuuu/git-context-graph

Show graph log of branch with its remote counterparts and default repository branch.
https://github.com/djuuu/git-context-graph

git git-log

Last synced: 10 months ago
JSON representation

Show graph log of branch with its remote counterparts and default repository branch.

Awesome Lists containing this project

README

          

# git-context-graph

[![Tests](https://github.com/Djuuu/git-context-graph/actions/workflows/test.yml/badge.svg)](https://github.com/Djuuu/git-context-graph/actions/workflows/test.yml)
[![License](https://img.shields.io/badge/license-Beerware%20%F0%9F%8D%BA-yellow)](https://web.archive.org/web/20160322002352/http://www.cs.trincoll.edu/hfoss/wiki/Chris_Fei:_Beerware_License)

Show graph log of branch with its remote counterparts and default repository branch.

This is a shortcut to `git log --graph` which provides a middle ground between
showing _only a given branch_ (which might lack context) and showing _all_ branches
(which might get crowded on big projects).

| `git log --graph` | `git log --graph --all` |
|:------------------------------------------------:|:---------------------------------------------------:|
| ![git log --graph](doc/git-log-graph-single.png) | ![git log --graph --all](doc/git-log-graph-all.png) |

| **`git context-graph`** |
|:-----------------------------------------------------:|
| ![git context-graph](doc/git-context-graph-large.png) |

## Synopsis

git context-graph [--local] [--no-default] [-a|--add] [<branch>...]
git context-graph [<git-log options>...] [<options>...] [<branch>...] [-- <paths>...]

git context-graph (-l|--list) [-s|--short] [<branch>]

git context-graph [<branch>...] (-A|--config-add) <additional_branch>...
git context-graph [<branch>...] (-C|--config-clear) [<additional_branch>...]

git context-graph (-h|--usage)

## Description

This command is a shortcut to:
```bash
git log --color --graph --abbrev-commit --decorate --pretty=oneline \
my-branch origin/my-branch main origin/main ...
```

* git context-graph [--local] [--no-default] [-a|--add] [<branch>...]
Show graph log of branch, its remote counterparts and default branch.

* git context-graph [<git-log options>...] [<options>...] [<branch>...] [-- <paths>...]
`git-log` options can be used to refine or customize the output
(see git-log documentation: https://git-scm.com/docs/git-log)
Ex:
git context-graph --pretty=medium -- some/path

* git context-graph (-l|--list) [-s|--short] [<branch>...]
List branches that would be shown in the graph (does not display graph).

* git context-graph [<branch>...] (-A|--config-add) <additional_branch>...
git context-graph [<branch>...] (-C|--config-clear) [<additional_branch>...]
For a given branch, persist additional context branches to git configuration.

* git context-graph (-h|--usage)
Show the help page.

## Arguments

* `...`
Branches to show graph for. If omitted, current branch will be used.

## Options

* `-a`|`--add`
Consider `` arguments as additional branches (added to current branch).

* `--local`
Show only local branches (ignore remotes).

* `--no-default`
Show only related branches (local and remote), without default branch.

* `-l`|`--list`
List branches that would be shown in the graph (does not display graph).

* `-s`|`--short`
Use short branch names when listing branches (without `refs/heads/` or `refs/remotes/`).
Implies `--list`.

* `-A`|`--config-add` `...`
For a given branch, persist additional context branches to git configuration.

* `-C`|`--config-clear` `[...]`
For a given branch, remove additional context branches from git configuration.
If no additional branch is passed, all configured additional branches will be removed.

* `-h`|`--usage`
Show command usage.

## Installation

* Add the `git-context-graph` directory to your `PATH`

in one of your shell startup scripts:
```bash
PATH="${PATH}:/path/to/git-context-graph"
```

_OR_

* Define it as a git alias:

run:
```bash
git config --global alias.cg '!bash /path/to/git-context-graph/git-context-graph'
```
or edit your `~/.gitconfig` directly:
```
[alias]
cg = "!bash /path/to/git-context-graph/git-context-graph"
```

Completion is available in `git-context-graph-completion.bash`. Source it in one of your shell startup scripts:
```bash
. "/path/to/git-context-graph/git-context-graph-completion.bash"
```