Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a posh-git equivalent for the Mac? [closed]

Tags:

git

macos

I just found (and have fallen hard for) PowerShell with the posh-git module installed. I'd really like something similar on my Mac. Does such an equivalent exist?

like image 346
fbrereto Avatar asked Sep 14 '12 23:09

fbrereto


People also ask

What is Poshgit?

posh-git is a PowerShell module that integrates Git and PowerShell by providing Git status summary information that can be displayed in the PowerShell prompt, e.g.: posh-git also provides tab completion support for common git commands, branch names, paths and more.

Can you use GitHub on Mac?

How to use Git and GitHub on Mac: Setup. To fully learn Git, you'll need to set up both Git and GitHub on your Mac. Both are long you've been programming, and what tools you've installed, you may already have Git on your computer. Open Terminal and enter git –version.

Does posh-git work with git bash?

Git Bash is a package that installs Bash, some common bash utilities, and Git on a Windows operating system. However, it is recommended to use Git with Posh-Git. It's a PowerShell environment for Git. It's an open source project hosted on GitHub.

Can you use git in PowerShell?

The "common" recommendation for command-line git on Windows is to use the "git-bash" shell. However, git works nicely from the Windows PowerShell with one small addition...


2 Answers

There are certainly ways to get features similar to what posh-git gives you.

For instance, installing bash-completion gives you the ability to <tab> complete Git commands.

Once you install bash-completion, you can add this to your .bash_profile:

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

This will include the current branch name in your prompt:

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

You can also add the following (found here) to your .bash_profile (before the PS1):

export GIT_PS1_SHOWDIRTYSTATE=true export GIT_PS1_SHOWUNTRACKEDFILES=true 

This will add flags after the branch name to show the repo's current state:

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 

You can also enable Git coloring with the following command:

git config --global color.ui auto

like image 141
redhotvengeance Avatar answered Sep 21 '22 13:09

redhotvengeance


I ported the posh-git module as a shell script.

As advised in the above post by redhotvengeance, you should install bash-completion to get tab-completion for Git commands.

like image 44
lyze Avatar answered Sep 21 '22 13:09

lyze