git bash 设置别名_使用Git设置分支别名
程序员文章站
2024-02-24 13:03:16
...
git bash 设置别名
Version control systems can be difficult to use, especially when you don't use a UI app. Just think about main branch or revision names: svn uses "trunk", git uses "master", and mercurial (hg) uses "tip". I need to switch between mercurial and git frequently, so I end up reversing command and branch names constantly.
版本控制系统可能难以使用,尤其是当您不使用UI应用程序时。 只需考虑主分支或修订版本名称:svn使用“ trunk”,git使用“ master”,而Mercurial(hg)使用“ tip”。 我需要经常在mercurial和git之间切换,因此最终会不断反转命令和分支名称。
To set a git branch alias, execute the following:
要设置git分支别名,请执行以下操作:
# alias -> real branch
git symbolic-ref refs/heads/trunk refs/heads/master
With the alias in place, you can execute commands like:
使用别名后,您可以执行以下命令:
git checkout trunk
git branch # * master
Not only can you create git aliases for commands, but you can create aliases for branches!
您不仅可以为命令创建git别名 ,还可以为分支创建别名!
git bash 设置别名