How do I avoid typing “git” at the begining of every Git command?

后端 未结 15 787
醉酒成梦
醉酒成梦 2021-01-29 22:31

I\'m wondering if there\'s a way to avoid having to type the word git at the beginning of every Git command.

It would be nice if there was a way to use the

15条回答
  •  心在旅途
    2021-01-29 22:45

    For basic stuff, you can do:

    function ggit(){ while true; do printf 'git> '; read; eval git $REPLY; done }
    
    git> status
    On branch master
    Your branch is ahead of 'origin/master' by 1 commit.
      (use "git push" to publish your local commits)
    
    Changes not staged for commit:
      (use "git add/rm ..." to update what will be committed)
      (use "git checkout -- ..." to discard changes in working directory)
    
        deleted:    yarn.lock
    
    no changes added to commit (use "git add" and/or "git commit -a")
    git> add .
    git> status
    On branch master
    Your branch is ahead of 'origin/master' by 1 commit.
      (use "git push" to publish your local commits)
    
    Changes to be committed:
      (use "git reset HEAD ..." to unstage)
    
        deleted:    yarn.lock
    
    git>
    

    Exit with ctrl+c

提交回复
热议问题