我如何在git中混淆命令? [英] How do I alias commands in git?

查看:161
本文介绍了我如何在git中混淆命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了某个人的屏幕录像

I saw a screencast where someone had gotten

git st
git ci

来运作。当我这样做时,我得到一个错误,问我是否意味着别的东西。

作为一个git newb,我需要知道你必须做什么才能完成它?

to work. When I do it I get an error asking me if I meant something else.
Being a git newb, I need to know what you have to do to get this done?

推荐答案

基本上你只需要添加行到〜/ .gitconfig

Basically you just need to add lines to ~/.gitconfig

[alias]
    st = status
    ci = commit -v

或者你可以使用git config alias命令:

Or you can use the git config alias command:

$ git config --global alias.st status 

在unix上,如果别名有空格,请使用单引号:

On unix, use single quotes if the alias has a space:

$ git config --global alias.ci 'commit -v'

在Windows中,如果别名有空格或命令行参数,请使用双引号:

On windows, use double quotes if the alias has a space or a command line argument:

c:\dev> git config --global alias.ci "commit -v"

alias命令甚至接受函数作为参数。查看别名

The alias command even accepts functions as parameters. Take a look at aliases.

这篇关于我如何在git中混淆命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆