<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marco Eckstein</title>
    <description>The latest articles on DEV Community by Marco Eckstein (@marcoeckstein).</description>
    <link>https://dev.to/marcoeckstein</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F936761%2F6d3f421a-df69-44fe-a821-4dd7e7ac30cf.png</url>
      <title>DEV Community: Marco Eckstein</title>
      <link>https://dev.to/marcoeckstein</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcoeckstein"/>
    <language>en</language>
    <item>
      <title>How to share TortoiseGit settings between multiple machines</title>
      <dc:creator>Marco Eckstein</dc:creator>
      <pubDate>Sun, 02 Oct 2022 17:04:31 +0000</pubDate>
      <link>https://dev.to/marcoeckstein/how-to-share-tortoisegit-settings-between-multiple-machines-3mol</link>
      <guid>https://dev.to/marcoeckstein/how-to-share-tortoisegit-settings-between-multiple-machines-3mol</guid>
      <description>&lt;h1&gt;
  
  
  How to share TortoiseGit settings between multiple machines
&lt;/h1&gt;

&lt;p&gt;The &lt;a href="https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html#tgit-dug-settings-export"&gt;official documentation&lt;/a&gt; says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you want to export all your client settings to use on another computer you can do so using the Windows registry editor &lt;em&gt;regedt32.exe&lt;/em&gt;. Go to the registry key &lt;em&gt;HKCU\Software\TortoiseGit&lt;/em&gt; and export it to a reg file. On the other computer, just import that file again (usually, a double click on the reg file will do that).&lt;/p&gt;

&lt;p&gt;Remember to save Git's general settings, which you can find in the Git configuration file &lt;em&gt;.gitconfig&lt;/em&gt; and/or the folder &lt;em&gt;.config/git&lt;/em&gt; which both are located in your user profile directory.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Unfortunately, in general it may not be so simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are some values which should probably never be shared between different TortoiseGit installations, e.g. &lt;em&gt;CurrentVersion&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;There are some values which you may not want to share between installations, e.g. those beneath the subkey &lt;em&gt;HKEY_CURRENT_USER\SOFTWARE\TortoiseGit\History&lt;/em&gt; if you have one installation at home and one at work.&lt;/li&gt;
&lt;li&gt;Some values will only be created when you change the configuration to be different then the default. E.g., a new installation will not have any values for context menu configuration. If you would use a &lt;em&gt;.reg&lt;/em&gt; file on another new installation, that would not be a problem. But if the other installation would already have values for non-default configuration, you would not overwrite the non-default configuration with the default configuration by importing a &lt;em&gt;.reg&lt;/em&gt; file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thus, you must carefully pick all the values you want to share. If you want to share default values, you must first deviate from the default values so that the values will be saved to the registry and then revert back to the default values, which will then be saved to the registry as well.&lt;/p&gt;

&lt;p&gt;I can not offer you a complete solution, but I will now walk you through the settings that I like to share between installations and show you how to set them with PowerShell.&lt;/p&gt;

&lt;h2&gt;
  
  
  Settings &amp;gt; General &amp;gt; Context Menu
&lt;/h2&gt;

&lt;p&gt;The values are named &lt;em&gt;ContextMenuEntries&lt;/em&gt; and &lt;em&gt;ContextMenuEntrieshigh&lt;/em&gt; (not &lt;em&gt;ContextMenuEntriesHigh&lt;/em&gt;). They seem to be the two halfs of a bit field where each bit represents a context menu item checked or unchecked.&lt;/p&gt;

&lt;p&gt;You can make them appear in the registry by selecting all items, saving, restoring to default values and saving again. At the time of writing - using TortoiseGit 2.13.0.1 - the defaults are 1030 and 32, respectively (in decimal notation).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ContextMenuEntries"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;1030&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ContextMenuEntrieshigh"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;32&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Settings &amp;gt; General &amp;gt; Context Menu 2
&lt;/h2&gt;

&lt;p&gt;The values are named &lt;em&gt;ContextMenuExtEntriesLow&lt;/em&gt; and &lt;em&gt;ContextMenuExtEntriesHigh&lt;/em&gt; and work analogous to those in the context menu.&lt;/p&gt;

&lt;p&gt;At the time of writing, the defaults are 1073741824 and 73728, respectively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ContextMenuExtEntriesLow"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;1073741824&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ContextMenuExtEntriesHigh"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;73728&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Settings &amp;gt; Diff Viewer
&lt;/h2&gt;

&lt;p&gt;If you configure a custom diff viewer, the command to call it will be saved in the value named &lt;em&gt;Diff&lt;/em&gt;. For using the built-in diff viewer, this value must be absent or prefixed with &lt;em&gt;#&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$DiffMergePath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$DiffMergeArguments&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/title1=%bname /title2=%yname %base %mine"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$Value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$DiffMergePath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$DiffMergeArguments&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Diff"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Value&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Settings &amp;gt; Diff Viewer &amp;gt; Merge Tool
&lt;/h2&gt;

&lt;p&gt;This works analogous to the diff viewer, using the value named &lt;em&gt;Merge&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$DiffMergePath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$DiffMergeArguments&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; 
    &lt;/span&gt;&lt;span class="s2"&gt;"/merge /caption=%mname /result=%merged /title1=%yname /title2=%bname /title3=%tname %mine %base %theirs"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$Value&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$DiffMergePath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$DiffMergeArguments&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Merge"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Value&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Log dialog &amp;gt; Columns
&lt;/h2&gt;

&lt;p&gt;The column configuration is located in the subkey &lt;em&gt;HKEY_CURRENT_USER\SOFTWARE\TortoiseGit\StatusColumns&lt;/em&gt;. I am only interested in &lt;em&gt;logloglist&lt;/em&gt; and &lt;em&gt;logloglist_Order&lt;/em&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit\StatusColumns"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"logloglist"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;1f1&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-ItemProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"HKCU:\SOFTWARE\TortoiseGit\StatusColumns"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"logloglist_Order"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"000102030405060809070A0B0C0D"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Caveat
&lt;/h2&gt;

&lt;p&gt;Note that there is no gurantee that this approach will be compatible with future versions of TortoiseGit,&lt;br&gt;
because the registry keys and values it uses do not constitute a public API and could thus be subject to&lt;br&gt;
changes anytime. I have filed a &lt;a href="https://gitlab.com/tortoisegit/tortoisegit/-/issues/4107"&gt;feature request&lt;/a&gt;&lt;br&gt;
addressing this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example script
&lt;/h2&gt;

&lt;p&gt;At GitHub, you can find my personal configuration script&lt;br&gt;
&lt;a href="https://github.com/marco-eckstein/admin-tools/blob/838e684ea69f073d083769155765b8488b22e704/windows/Set-TortoiseGitSettings.ps1"&gt;Set-TortoiseGitSettings.ps1&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Revision history
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;2024-01-06:

&lt;ul&gt;
&lt;li&gt;fix: replace unintended hex values with decimal values; replace script link with link to fixed version&lt;/li&gt;
&lt;li&gt;add caveat paragraph&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
