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.
- Host: GitHub
- URL: https://github.com/djuuu/git-context-graph
- Owner: Djuuu
- License: other
- Created: 2022-12-17T23:18:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-08T00:44:54.000Z (about 1 year ago)
- Last Synced: 2025-04-01T17:59:39.842Z (11 months ago)
- Topics: git, git-log
- Language: Shell
- Homepage:
- Size: 220 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-context-graph
[](https://github.com/Djuuu/git-context-graph/actions/workflows/test.yml)
[](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 context-graph`** |
|:-----------------------------------------------------:|
|  |
## 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"
```