我看了一段录像,里面有人
git st
git ci
去工作。当我这样做时,我得到一个错误,问我是否我指的是其他东西。 作为一个新手,我想知道你要怎么做才能完成这件事?
我看了一段录像,里面有人
git st
git ci
去工作。当我这样做时,我得到一个错误,问我是否我指的是其他东西。 作为一个新手,我想知道你要怎么做才能完成这件事?
当前回答
这将为status创建一个别名st:
Git配置——添加别名。圣的地位
其他回答
alias s="git status"
你的食指会原谅你这辈子给它带来的所有痛苦。
$ 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别名执行shell命令的人,例如:
$ git pof
在我的终端将推动当前分支到我的原点回购:
[alias]
pof = !git push origin -f $(git branch | grep \\* | cut -d ' ' -f2)
在哪里
$(git branch | grep \\* | cut -d ' ' -f2)
命令返回当前分支。
这是手动输入分支名称的快捷方式:
git push origin -f <current-branch>
我认为最有用的gitconfig是这样的,我们总是在git中使用20%的函数,你可以试试“g ll”,它是惊人的,细节:
[user]
name = my name
email = me@example.com
[core]
editor = vi
[alias]
aa = add --all
bv = branch -vv
ba = branch -ra
bd = branch -d
ca = commit --amend
cb = checkout -b
cm = commit -a --amend -C HEAD
ci = commit -a -v
co = checkout
di = diff
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
ld = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
mm = merge --no-ff
st = status --short --branch
tg = tag -a
pu = push --tags
un = reset --hard HEAD
uh = reset --hard HEAD^
[color]
diff = auto
status = auto
branch = auto
[branch]
autosetuprebase = always
如果你使用'!'操作符来生成一个shell:
aa = !git add -A && git status
这将添加所有文件,并为您提供$ git aa的状态报告。
为了方便地检查你的别名,添加这个别名:
alias = config --get-regexp ^alias\\.
然后一个快速的$ git别名会告诉你当前的别名以及它们的用途。