On Fri, 29 Aug 2025 at 21:22, Brian Inglis via Cygwin wrote: > > On 2025-08-29 06:25, J via Cygwin wrote: > > Hello! > > I'm trying understand the proper way to acheive a git-decorated-prompt > > under cygwin. > > When using git-bash in Windows, it automatically sets the prompt to reflect > > the current repositor branch when cd'ing to a folder that contains a git > > sandbox. > > To obtain this effect under Ubuntu, it was necessary to set the PS1 > > (prompt) variable in ~/.bashrc to the following: > > export PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]\n\[\033[32m\]\u@\h > > \[\033[35m\]$MSYSTEM \[\033[33m\]\w\[\033[36m\]`__git_ps1`\[\033[0m\]\n$ ' > > This appears to work by using the aliases that the git package installs. > > Since Ubuntu is general-purpose and not for a specific use like git-bash > > is, it does not automatically set the prompt for you. > > For Gentoo, setting the PS1 variable in ~/.bashrc did not work, because > > even after installing git, it did not install its aliases in the profiles. > > So for Gentoo, putting the following line in ~/.bashrc made the prompt > > variable acheive the desired effect: > > . /usr/share/git/git-prompt.sh > > Now on to Cygwin. > > Even though I've installed git, the git aliases don't seem to be present, > > or at least I can't figure out how to get them set. > > Thank you for reading, and thank you in advance > > Looks like the Cygwin git package provides only bash completions, not > available > zsh and tcsh completions under contrib/completion/, nor the optional > git-prompt.sh, or other scripts available under contrib/. > > You can curl -JLORSsZ or wget/2 -N from > <https://raw.githubusercontent.com/git/git/refs/heads/master/contrib/completion/git-prompt.sh> > > Other projects provide shell and git aliases and completions for better > integration.
Correct. This shouldn't be difficult to add to the Git packaging for Cygwin, but with my (somewhat dusty) Git maintainer hat on, I've historically been reluctant to include things from contrib unless I was very confident they wouldn't cause problems. In particular, as someone who has had git-prompt.sh manually included in his standard dotfile configuration, I'm aware it can be _painfully_ slow in moderate-to-large repositories on Cygwin thanks to the additional overheads of the Cygwin compatibility layers between the Git C code and the Windows filesystem. git-bash has similar issues, but somewhat less pronounced thanks to the compatibility layers being thinner. None of this means there's no way to package these scripts, or that they shouldn't be distributed in such a way that (as is apparently the case with Gentoo) a user can opt in to having them included. But, as ever, someone has to make and document that change, and when I haven't been able to keep up with Git releases for over a year, I'm definitely not the person with the bandwidth to do it. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple

