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

git st
git ci

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


当前回答

这招对我很管用:

bco = "!f(){ git branch ${1} && git checkout ${1}; };f"

on:

$ git --version

git version 1.7.7.5 (Apple Git-26)

其他回答

$ 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.

需要执行命令git config alias。在Git存储库中执行以下命令:

git config alias.ci commit

对于全局别名:

git config --global alias.ci commit

在.gitconfig中包含多个别名文件

我建议使用.gitconfig include作为别名。一旦你开始创建别名,你可能最终会有很多。它们很可能是你想与他人分享的东西。把它们放在一个专用的文件中可以很容易地共享。您的团队甚至可以使用git回购来保存共享别名。当然还有一些你不想分享的别名,所以把它们保存在一个私人别名文件中。

[include]
    path=src/dotfiles/.gitaliases

[include]
    path=src/team-utils/gitaliases

[include]
    path=.gitaliases.private

要在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

windows的另一种可能是在一个目录中填满含有快捷方式的.bat文件。文件的名称就是要使用的快捷方式。只需将该目录添加到您的PATH环境变量中,您就可以在cmd窗口中使用所有的快捷方式。

例如(gc.bat):

git commit -m %1

在控制台中执行如下命令:

gc "changed stuff"

我添加这个作为答案的原因是,当使用这个时,你不局限于git…只有命令。