<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Sayed Ibrahim Hashimi - MSBuild, Web Deploy (MSDeploy), ASP.NET - git</title>
    <link>http://sedodream.com/</link>
    <description>MSBuild, C#, Visual Studio and more</description>
    <language>en-us</language>
    <copyright>Sayed Ibrahim Hashimi</copyright>
    <lastBuildDate>Sat, 05 May 2012 21:48:23 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>sayed.hashimi@gmail.com</managingEditor>
    <webMaster>sayed.hashimi@gmail.com</webMaster>
    <item>
      <trackback:ping>http://sedodream.com/Trackback.aspx?guid=9f1280ce-421d-4a59-b41b-d9c6e709f10e</trackback:ping>
      <pingback:server>http://sedodream.com/pingback.aspx</pingback:server>
      <pingback:target>http://sedodream.com/PermaLink,guid,9f1280ce-421d-4a59-b41b-d9c6e709f10e.aspx</pingback:target>
      <dc:creator>Ibrahim</dc:creator>
      <wfw:comment>http://sedodream.com/CommentView,guid,9f1280ce-421d-4a59-b41b-d9c6e709f10e.aspx</wfw:comment>
      <wfw:commentRss>http://sedodream.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9f1280ce-421d-4a59-b41b-d9c6e709f10e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been using Git for my open source projects recently and have been loving it.
If you are like me and you like using the PowerShell prompt instead of the normal
command prompt then you have to install <a href="https://github.com/dahlbyk/posh-git" target="_blank">posh-git</a>.
posh-git extends the PowerShell prompt to include information about the git repository
and also makes remote operations simpler. After using git in this way I quickly noticed
that the colors were not very readable. For example take a look at the screen shot
below.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_4.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_thumb_1.png" width="737" height="279" />
          </a>
        </p>
        <p>
In the image above you can see that the text in dark red is difficult to read. This
text comes from two different places. For the text relating to modified and untracked
files, that is coming directly from git.exe and for the text after <strong>[master</strong> that
is coming from posh-git. In order to make this easier to read we have to modify the
color settings for both.
</p>
        <h3>Modifying text color settings for git.exe
</h3>
        <p>
When using git.exe you can configure the color settings using <a href="http://man.he.net/man1/git-config" target="_blank">git
config</a>. There are a bunch of color settings which you can control, which are all
listed on the manpage for git config. In my case I want to update the color for modified
files and untracked files, those can be configured with <strong>color.status.changed</strong> and <strong>color.status.untracked</strong> respectively.
The color options that you have to pick from include:
</p>
        <ul>
          <li>
normal</li>
          <li>
black</li>
          <li>
red</li>
          <li>
green</li>
          <li>
yellow</li>
          <li>
blue</li>
          <li>
magenta</li>
          <li>
cyan</li>
          <li>
white</li>
        </ul>
        <p>
In my case I wanted the text for those settings to be the same color as the master
text in the image above. In order to set the color you can use the syntax:
</p>
        <blockquote>
          <p>
            <font face="Consolas">git config &lt;color-to-update&gt; “foreground-color background-color
attribute”</font>
          </p>
        </blockquote>
        <p>
The attribute value can be any of these values; bold, dim, ul, blink and reverse.
</p>
        <p>
In my case I executed the following command:
</p>
        <blockquote>
          <p>
            <font face="Consolas">git config --global color.status.changed "cyan normal bold" 
<br />
git config --global color.status.untracked "cyan normal bold"</font>
          </p>
        </blockquote>
        <p>
Notice that I used the <em>--global</em> switch to indicate that I wanted the settings
to be persisted in the global .gitconfig file instead of the one for the specific
project that I was working on. So this got me to:
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_6.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_thumb_2.png" width="737" height="279" />
          </a>
        </p>
        <p>
Almost there, now I need to modify the color for the summary provided by posh-git.
A good resource for more info here is <a href="http://git-scm.com/book/ch7-1.html#Colors-in-Git">http://git-scm.com/book/ch7-1.html#Colors-in-Git</a>.
</p>
        <h3>Modifying text color for posh-git
</h3>
        <p>
posh-git stores all of it’s color settings in the $global:GitPromptSettings variable,
you can see them declared in the <a href="https://github.com/dahlbyk/posh-git/blob/master/GitPrompt.ps1" target="_blank">GitPrompt.ps1</a> file.
If you want to change the values for the colors you should not edit that file (that
file might get updated later). Instead all you need to do is to override the value
for the particular color after posh-git has been loaded. The best way to do this is
to edit your PowerShell profile. This file is executed every time you open a PS prompt.
You can find the location of this file by executing $profile in a PS prompt. In that
file you should see a line initializing posh-git in my case it was:
</p>
        <blockquote>
          <p>
            <font face="Consolas">. 'G:\Data\Development\OpenSource\posh-git\profile.example.ps1'</font>
          </p>
        </blockquote>
        <p>
You should place your customizations after this statement. So in my case I wanted
to change the summary text from dark red to yellow, so I added the following lines
to my PS profile.
</p>
        <blockquote>
          <p>
            <font face="Consolas">$global:GitPromptSettings.WorkingForegroundColor   
= [ConsoleColor]::Yellow 
<br />
$global:GitPromptSettings.UntrackedForegroundColor  = [ConsoleColor]::Yellow</font>
          </p>
        </blockquote>
        <p>
I closed the PS window and opened a new one and now here is the result.
</p>
        <p>
          <a href="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_8.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_thumb_3.png" width="737" height="279" />
          </a>
        </p>
        <p>
Now that’s better!
</p>
        <p>
FYI if you are looking to install <a href="https://github.com/dahlbyk/posh-git" target="_blank">posh-git</a> you
can follow a simple walk through on Phil Haack’s blog at <a href="http://haacked.com/archive/2011/12/13/better-git-with-powershell.aspx" target="_blank">Better
Git with PowerShell</a>.
</p>
        <p>
I’d like to thank <a href="https://twitter.com/#!/bradwilson" target="_blank">Brad
Wilson</a> and <a href="https://twitter.com/#!/dahlbyk" target="_blank">Keith Dahlby</a> for
pointing me in the right direction regarding these settings.
</p>
        <p>
 
</p>
        <p>
Sayed Ibrahim Hashimi | <a href="http://twitter.com/sayedihashimi" target="_blank">@SayedIHashimi</a></p>
        <p>
          <a href="https://github.com/sayedihashimi" target="_blank">My Github account</a>
        </p>
      </body>
      <title>Git customizing colors for Windows including posh-git</title>
      <guid isPermaLink="false">http://sedodream.com/PermaLink,guid,9f1280ce-421d-4a59-b41b-d9c6e709f10e.aspx</guid>
      <link>http://sedodream.com/2012/05/05/GitCustomizingColorsForWindowsIncludingPoshgit.aspx</link>
      <pubDate>Sat, 05 May 2012 21:48:23 GMT</pubDate>
      <description>&lt;p&gt;
I’ve been using Git for my open source projects recently and have been loving it.
If you are like me and you like using the PowerShell prompt instead of the normal
command prompt then you have to install &lt;a href="https://github.com/dahlbyk/posh-git" target="_blank"&gt;posh-git&lt;/a&gt;.
posh-git extends the PowerShell prompt to include information about the git repository
and also makes remote operations simpler. After using git in this way I quickly noticed
that the colors were not very readable. For example take a look at the screen shot
below.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_thumb_1.png" width="737" height="279" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the image above you can see that the text in dark red is difficult to read. This
text comes from two different places. For the text relating to modified and untracked
files, that is coming directly from git.exe and for the text after &lt;strong&gt;[master&lt;/strong&gt; that
is coming from posh-git. In order to make this easier to read we have to modify the
color settings for both.
&lt;/p&gt;
&lt;h3&gt;Modifying text color settings for git.exe
&lt;/h3&gt;
&lt;p&gt;
When using git.exe you can configure the color settings using &lt;a href="http://man.he.net/man1/git-config" target="_blank"&gt;git
config&lt;/a&gt;. There are a bunch of color settings which you can control, which are all
listed on the manpage for git config. In my case I want to update the color for modified
files and untracked files, those can be configured with &lt;strong&gt;color.status.changed&lt;/strong&gt; and &lt;strong&gt;color.status.untracked&lt;/strong&gt; respectively.
The color options that you have to pick from include:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
normal&lt;/li&gt;
&lt;li&gt;
black&lt;/li&gt;
&lt;li&gt;
red&lt;/li&gt;
&lt;li&gt;
green&lt;/li&gt;
&lt;li&gt;
yellow&lt;/li&gt;
&lt;li&gt;
blue&lt;/li&gt;
&lt;li&gt;
magenta&lt;/li&gt;
&lt;li&gt;
cyan&lt;/li&gt;
&lt;li&gt;
white&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In my case I wanted the text for those settings to be the same color as the master
text in the image above. In order to set the color you can use the syntax:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Consolas"&gt;git config &amp;lt;color-to-update&amp;gt; “foreground-color background-color
attribute”&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
The attribute value can be any of these values; bold, dim, ul, blink and reverse.
&lt;/p&gt;
&lt;p&gt;
In my case I executed the following command:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Consolas"&gt;git config --global color.status.changed &amp;quot;cyan normal bold&amp;quot; 
&lt;br /&gt;
git config --global color.status.untracked &amp;quot;cyan normal bold&amp;quot;&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Notice that I used the &lt;em&gt;--global&lt;/em&gt; switch to indicate that I wanted the settings
to be persisted in the global .gitconfig file instead of the one for the specific
project that I was working on. So this got me to:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_thumb_2.png" width="737" height="279" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Almost there, now I need to modify the color for the summary provided by posh-git.
A good resource for more info here is &lt;a href="http://git-scm.com/book/ch7-1.html#Colors-in-Git"&gt;http://git-scm.com/book/ch7-1.html#Colors-in-Git&lt;/a&gt;.
&lt;/p&gt;
&lt;h3&gt;Modifying text color for posh-git
&lt;/h3&gt;
&lt;p&gt;
posh-git stores all of it’s color settings in the $global:GitPromptSettings variable,
you can see them declared in the &lt;a href="https://github.com/dahlbyk/posh-git/blob/master/GitPrompt.ps1" target="_blank"&gt;GitPrompt.ps1&lt;/a&gt; file.
If you want to change the values for the colors you should not edit that file (that
file might get updated later). Instead all you need to do is to override the value
for the particular color after posh-git has been loaded. The best way to do this is
to edit your PowerShell profile. This file is executed every time you open a PS prompt.
You can find the location of this file by executing $profile in a PS prompt. In that
file you should see a line initializing posh-git in my case it was:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Consolas"&gt;. 'G:\Data\Development\OpenSource\posh-git\profile.example.ps1'&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
You should place your customizations after this statement. So in my case I wanted
to change the summary text from dark red to yellow, so I added the following lines
to my PS profile.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;font face="Consolas"&gt;$global:GitPromptSettings.WorkingForegroundColor&amp;#160;&amp;#160;&amp;#160;
= [ConsoleColor]::Yellow 
&lt;br /&gt;
$global:GitPromptSettings.UntrackedForegroundColor&amp;#160; = [ConsoleColor]::Yellow&lt;/font&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
I closed the PS window and opened a new one and now here is the result.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_8.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://sedodream.com/content/binary/Windows-Live-Writer/git-customizing-colors-including-posh-gi_C69A/image_thumb_3.png" width="737" height="279" /&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Now that’s better!
&lt;/p&gt;
&lt;p&gt;
FYI if you are looking to install &lt;a href="https://github.com/dahlbyk/posh-git" target="_blank"&gt;posh-git&lt;/a&gt; you
can follow a simple walk through on Phil Haack’s blog at &lt;a href="http://haacked.com/archive/2011/12/13/better-git-with-powershell.aspx" target="_blank"&gt;Better
Git with PowerShell&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
I’d like to thank &lt;a href="https://twitter.com/#!/bradwilson" target="_blank"&gt;Brad
Wilson&lt;/a&gt; and &lt;a href="https://twitter.com/#!/dahlbyk" target="_blank"&gt;Keith Dahlby&lt;/a&gt; for
pointing me in the right direction regarding these settings.
&lt;/p&gt;
&lt;p&gt;
&amp;#160;
&lt;/p&gt;
&lt;p&gt;
Sayed Ibrahim Hashimi | &lt;a href="http://twitter.com/sayedihashimi" target="_blank"&gt;@SayedIHashimi&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="https://github.com/sayedihashimi" target="_blank"&gt;My Github account&lt;/a&gt;
&lt;/p&gt;</description>
      <comments>http://sedodream.com/CommentView,guid,9f1280ce-421d-4a59-b41b-d9c6e709f10e.aspx</comments>
      <category>git</category>
      <category>posh-git</category>
    </item>
  </channel>
</rss>