Re: git aliases in cygwin

2025年8月29日 13:22:08 -0700

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:$PWD007円\]\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.
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut
 -- Antoine de Saint-Exupéry
--
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

Reply via email to