Skip to content

Ability to use the commands as sub-commands of git #147

Description

@goodevilgenius

I think this would be pretty useful if it was possible to use as a sub-command of git, rather than as shell aliases.

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Suggested solution

I've put together a shell script that does this, but a little better integration might be better, as well as bash completion. I name this git-forgit, and put it in my path, and I can do, for example, git forgit log, instead of forgit::log, or glo

#!/bin/bash

export FORGIT_NO_ALIASES=true

. /path/to/forgit/forgit.plugin.zsh

command="$1"
shift

case "$command" in
    add) forgit::add "$@" ;;
    reset-head) forgit::reset::head "$@" ;;
    log) forgit::log "$@" ;;
    diff) forgit::diff "$@" ;;
    ignore) forgit::ignore "$@" ;;
    clean) forgit::clean "$@" ;;
    rebase) forgit::rebase "$@" ;;
    stash-show) forgit::stash::show "$@" ;;
    cherry-pick) forgit::cherry::pick "$@" ;;
    checkout)
        sub="$1"
        shift
        case "$sub" in
            file) forgit::checkout::file "$@" ;;
            branch) forgit::checkout::branch "$@" ;;
        esac
        ;;
esac

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions