![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Gitk is a graphical utility included with Git (under C:\Program Files\Git\cmd), which can show all commits to a repository, or all commits which changed a specific file or folder.
It is the same as the "Git History" option which was included by Git version 1.x in the Windows Explorer context menu. Git version 2.x does not add the context menu entry. You must add it yourself, if you want to be able to invoke Gitk without using the command line.
Note: ONLY do these steps if you are familiar with updating the Registry, because if the Registry becomes corrupted, it can cause Windows to completely stop working.
To add a Git History context menu item for files, add this registry key:
HKCR\*\shell\GitHistory\command
Update the "(Default)" String value to: "C:\Program Files\Git\cmd\gitk.exe" -- "%1"
(there should be one space both before and after the double dashes)
Now when you right-click a file in Windows Explorer, there should be a "GitHistory" entry in the context menu.
To add a Git History context menu entry for folders, first save the following line to a batch file named "GitHistory.cmd":
cd "%1" && "C:\Program Files\Git\cmd\gitk.exe" -- "%1"
(there should be one space both before and after the double dashes)
Then add this registry key:
HKCR\Directory\shell\GitHistory\command
Update the "(Default)" String value to: C:\cmd\GitHistory.cmd "%1"
(change the path to match your batch file location)
Now when you right-click a Git folder in Windows Explorer, there will be a "GitHistory" entry along with the default "Git GUI" and "Git Bash" entries.
If you directly reference the gitk command instead of the batch file in the Directory registry key, the working directory won't be set right, and gitk will not work right.
It is the same as the "Git History" option which was included by Git version 1.x in the Windows Explorer context menu. Git version 2.x does not add the context menu entry. You must add it yourself, if you want to be able to invoke Gitk without using the command line.
Note: ONLY do these steps if you are familiar with updating the Registry, because if the Registry becomes corrupted, it can cause Windows to completely stop working.
To add a Git History context menu item for files, add this registry key:
HKCR\*\shell\GitHistory\command
Update the "(Default)" String value to: "C:\Program Files\Git\cmd\gitk.exe" -- "%1"
(there should be one space both before and after the double dashes)
Now when you right-click a file in Windows Explorer, there should be a "GitHistory" entry in the context menu.
To add a Git History context menu entry for folders, first save the following line to a batch file named "GitHistory.cmd":
cd "%1" && "C:\Program Files\Git\cmd\gitk.exe" -- "%1"
(there should be one space both before and after the double dashes)
Then add this registry key:
HKCR\Directory\shell\GitHistory\command
Update the "(Default)" String value to: C:\cmd\GitHistory.cmd "%1"
(change the path to match your batch file location)
Now when you right-click a Git folder in Windows Explorer, there will be a "GitHistory" entry along with the default "Git GUI" and "Git Bash" entries.
If you directly reference the gitk command instead of the batch file in the Directory registry key, the working directory won't be set right, and gitk will not work right.
small improvement
Date: 2018-07-04 09:01 am (UTC)You don't need an extra file if you change the command Default string to this:
cmd /c cd "%V" && "C:\Program Files\Git\cmd\gitk.exe"
Re: small improvement
Date: 2018-07-07 07:47 pm (UTC)no subject
Date: 2020-11-10 12:57 pm (UTC)set file_path_win=%1
set file_path_bash=%file_path_win:\=/%
gitk "%file_path_bash%"
I then set the 'Computer\HKEY_CLASSES_ROOT\*\shell\GitHistory\command' '(Default)' to "" "%1"
no subject
Date: 2020-11-11 03:50 am (UTC)