How to make bash suppose all commands to be git commands?

Can I make bash to suppose the command always to be a git command?

I mean:

  • can I make a git alias from this?
  • How to alias 'git checkout' to 'git co'?
  • git alias including checkout and pull + rebase with params
  • make alias for svn repository
  • How can I delete a git alias?
  • User Input to Bash Alias?
  • If I wrote push origin master then it would execute git push origin master?

    Note: I would use it in git bash (Windows environment), so I do not need regular commands (ls, cd, etc.) to work.

  • gitignore all files (specific filetype) in a directory and subdirectories
  • git rebase and file conflict
  • What ReSharper files should I keep and what files should I ignore in Source Control?
  • Windows version of rxvt Backspace key doesn't work as expected
  • Commits to Capture Problems in Git: Good Idea?
  • GIT SVN: fetching a recreated SVN branch without the wrong merge parent
  • 4 Solutions collect form web for “How to make bash suppose all commands to be git commands?”

    You may want to try this small git shell, instead:

    gitsh () {
        while read -r -p "gitsh> " -a GITCOMMAND; do
            git "${GITCOMMAND[@]}"
        done
    }
    

    After that function is defined, run it once, and it will sit in an infinite loop,
    reading a command line and passing it as options to the git command.

    EDIT: Adding the -e option to the read command, as suggested by gniourf_gniourf, gives you a nice Readline-based environment where you can retrieve and edit your history.

    You could add aliases for commonly used commands e.g. push would become git push etc. This solution needs to specify all commands you are using, but should not break anything.

    Assuming “git bash” is like regular bash, use the command_not_found_handle function:

    function command_not_found_handle {
      command git "$0" "$@"
    }
    

    http://www.gnu.org/software/bash/manual/bashref.html#Command-Search-and-Execution

    The possibility for sending git inadvertent commands exists, but that’s what you’re asking for in the question.

    You may add scripts named push, commit etc. to your PATH. This way your shell would have push, commit etc. “commands”. This should work with whatever shell you are using, not only bash.

    Git Baby is a git and github fan, let's start git clone.