Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。












想改善这个问题吗?更新问题,以便将其作为on-topic用于堆栈溢出。

2年前关闭。



Improve this question




我刚刚发现并已安装posh-git模块的PowerShell。我真的很想要Mac上的类似软件。是否存在这样的等价物?

最佳答案

当然,有一些方法可以获取类似于posh-git给您的功能。

例如,installing bash-completion 使您能够<tab>完整的Git命令。

安装bash-completion后,您可以将其添加到.bash_profile中:
PS1='\u@\h \W$(__git_ps1 " (%s)")\$ '
这将在提示中包括当前分支名称:
user@computer-name current-folder (branch-name)$
您还可以将以下内容(找到here)添加到.bash_profile中(在PS1之前):

export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILES=true

这将在分支名称之后添加标志以显示存储库的当前状态:
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

您还可以使用以下命令启用Git着色:
git config --global color.ui auto

关于git - Mac是否有与posh-git相当的产品? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12433165/

10-14 23:48
查看更多