UPDATE: This has been resolved now - with the "Add Alias" feature.
It turns out git
itself has no provision to specify the repository name. The root directory name is the single source of truth pertaining to repository name. The .git/description
though is used only by some applications like Gitweb
.
Also GitHub desktop
has no provision to rename the local repositories.
Workaround:
To override displayed repo names ( to be run in dev-tools: [View
> Toggle developer tools
] )
Best to save it as a snippet (Sources
> Snippets
) [unfortunately this will have to be run on each start]
function getElementByXpath(path) {
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}
function overrideRepoNames(repoNames) {
for (x in repoNames) {
getElementByXpath('//*[@id="__ListRow_1-' + (parseInt(x) + 1) + '"]/div/div[2]/span/span').innerHTML = repoNames[x].replace(new RegExp('\\\\','g'), ' \\ ')
}
}
repoNames = ['Ujnotes\\Website\\Framework', 'WCode\\Website\\Framework', 'WCode\\Website\\interim', 'WCode\\Location\\interim', 'Ujnotes\\Website\\interim', 'WCode\\Location\\Paper', 'WCode\\Website\\Project', 'WCode\\Android\\Project', 'WCode\\Windows\\Project', 'WCode\\Location\\Project', 'Ujnotes\\Website\\Project'];
getElementByXpath('//*[@id="desktop-app-toolbar"]/div[1]/div/div/button').addEventListener('click', function(event) {
setTimeout(function() {
if(getElementByXpath('//*[@id="foldout-container"]') != null)
overrideRepoNames(repoNames)
}, 50);
});
This is the result:
Here is AHK
script to automate the execution of the script snippet at launch:
Run, "%LocalAppData%\GitHubDesktop\GitHubDesktop.exe"
winWait, GitHub Desktop
sleep, 1000
send, {CTRLDOWN}{SHIFTDOWN}i{SHIFTUP}{CTRLUP}
sleep, 2000
send, {CTRLDOWN}{SHIFTDOWN}p{SHIFTUP}{CTRLUP}
sleep, 2000
send, {BACKSPACE}
sleep, 100
send, {!}
sleep, 100
send, {ENTER}
sleep, 500
send, {CTRLDOWN}{SHIFTDOWN}i{SHIFTUP}{CTRLUP}
project\website
and want to refrain fromproject\project-website
– PublicnessGitHub desktop
app – Publicness