Skip to content

Djuuu/git-context-graph

Repository files navigation

git-context-graph

Tests 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 git log --graph --all
git context-graph
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:

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

  • <branch>...
    Branches to show graph for. If omitted, current branch will be used.

Options

  • -a|--add
    Consider <branch> 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 <additional_branch>...
    For a given branch, persist additional context branches to git configuration.

  • -C|--config-clear [<additional_branch>...]
    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:
    PATH="${PATH}:/path/to/git-context-graph"

OR

  • Define it as a git alias:
    run:
    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:

. "/path/to/git-context-graph/git-context-graph-completion.bash"

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages