我看了一段录像,里面有人

git st
git ci

去工作。当我这样做时,我得到一个错误,问我是否我指的是其他东西。 作为一个新手,我想知道你要怎么做才能完成这件事?


当前回答

你可以使用git的配置设置自定义的git别名。语法如下:

git config --global alias.<aliasName> "<git command>"

例如,如果你需要一个别名来显示有合并冲突的文件列表,运行:

git config --global alias.conflicts "diff --name-only --diff-filter=U"

现在你只能使用"conflicts"来使用上面的命令:

git conflicts
# same as running: git diff --name-only --diff-filter=U

其他回答

这将为status创建一个别名st:

Git配置——添加别名。圣的地位

$ git update
git: 'update' is not a git command. See 'git --help'.

Did you mean this?
    update-ref

$ git config --global alias.update 'pull -v'

$ git update
From git://git.kernel.org/pub/scm/git/git
 = [up to date]      html       -> origin/html
 = [up to date]      maint      -> origin/maint
 = [up to date]      man        -> origin/man
 = [up to date]      master     -> origin/master
 = [up to date]      next       -> origin/next
 = [up to date]      pu         -> origin/pu
 = [up to date]      todo       -> origin/todo
Already up-to-date.
alias s="git status"

你的食指会原谅你这辈子给它带来的所有痛苦。

如果你使用'!'操作符来生成一个shell:

aa = !git add -A && git status

这将添加所有文件,并为您提供$ git aa的状态报告。

为了方便地检查你的别名,添加这个别名:

alias = config --get-regexp ^alias\\.

然后一个快速的$ git别名会告诉你当前的别名以及它们的用途。

要在Git中创建别名,请使用以下命令:

git config --local alias.s status

git config --local alias.c commit
git s

On branch master

nothing to commit, working tree clean

git status

On branch master

nothing to commit, working tree clean