-2

现在我使用 ubntu 17.10。

例如如何更改 git 命令

  • git add .命令之类ga的,
  • git commit命令之类的gc
  • git pushcommans lije`gp

其他示例,例如 $ git add 命令,例如 $ ga

当我输入 ga 时,它就像 git add

4

3 回答 3

4

考虑使用 Git 别名,例如

git config --global alias.co checkout

https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases

要准确实现您想要的,您可以使用 bash 别名

在您的 bash 提示符类型中

alias ga="git add ."

这仅在您关闭 shell 之前有效。要使您的别名保持不变,请将它们添加到您的 ~/.profile 文件中。

echo 'alias ga="git add ."' >> ~/.profile

Ubuntu 使用 ~/.profile 而不是 ~/.bash_profile。

祝你好运!

于 2018-02-06T09:20:55.367 回答
1

你想aliases在你的 shell 中使用。对于重击

echo "alias ga='git add .'" >> ~/.bash_profile
echo "alias gc='git commit'" >> ~/.bash_profile
echo "alias gp='git push'" >> ~/.bash_profile

或者,对于ZShell

echo "alias ga='git add .'" >> ~/.zshrc
echo "alias gc='git commit'" >> ~/.zshrc
echo "alias gp='git push'" >> ~/.zshrc

运行后,只需打开新终端即可。

于 2018-02-06T09:20:51.000 回答
0

如果我正确理解了您的问题,那么下面将详细说明如何使用别名

Git 基础 - Git 别名

于 2018-02-06T09:17:32.617 回答