是否有适合Mac的豪华git?

fbr*_*eto 26 git macos

我刚刚安装了posh-git模块,发现了(并且已经很难实现)PowerShell.我真的很喜欢我的Mac上类似的东西.这样的等价物是否存在?

red*_*nce 40

肯定有办法获得类似于posh-git给你的功能.

例如,安装bash-completion使您能够<tab>完成Git命令.

安装后bash-completion,您可以将其添加到.bash_profile:

PS1='\u@\h \W$(__git_ps1 " (%s)")\$ '

这将在您的提示中包含当前分支名称:

user@computer-name current-folder (branch-name)$

您还可以将以下(在此处找到)添加到您的.bash_profile(在PS1之前):

export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true
Run Code Online (Sandbox Code Playgroud)

这将在分支名称后添加标志以显示repo的当前状态:

user@computer-name current-folder (branch-name *)$ #Repo has modified files
user@computer-name current-folder (branch-name +)$ #Repo has staged files
user@computer-name current-folder (branch-name %)$ #Repo has untracked files
Run Code Online (Sandbox Code Playgroud)

您还可以使用以下命令启用Git着色:

git config --global color.ui auto


lyz*_*yze 18

我将posh-git模块移植为shell脚本.

正如上面的帖子所述redhotvengeance,你应该安装bash-completion以获得Git命令的tab-completion.

  • 只需在我的机器上设置端口即可。太好了,谢谢@lyze! (2认同)