![]() Add absolute path to the home directory we created (or to the directory where you want to have your.Go to etc folder and open the file called profile (In my case, it's E:\git\etc\profile).gitconfig and other bash files in E, so I created a folder called home where I want them all in. Run the file and install it in the required location. I use portable version of Git, so all my config files are on my pen-drive(E:). Solution without having to change Windows HOME variable Set-content $localPath $redirectAutoText -force If (::IsNullOrWhitespace($appendSettings))Īdd-content $globalPath ("`n# Additional settings added from $env:COMPUTERNAME on " + (Get-Date -displayhint date) + "`n" + $appendSettings) $localLines = (get-content $localPath | select -Skip $skipLines) -join "`n" Write-warning "New settings found in $localPath.`n " Write-warning "New settings appended to $localPath.`n " Select -f 3) -diff ($localText | select -f 3) | measure-object).count $diffs = (compare-object -ref $redirectAutoText.split("`n") -diff ($localText) | $globalPath = "C:\src\github\Global\Git\gitconfig".replace('\', "\\") $localPath = "$env:USERPROFILE\.gitconfig".replace('\', "\\") This is useful for tools like SourceTree which will write new updates if they cannot find existing ones and do not follow includes. Sept 9th: Updated to detect when new entries added to the config file are duplicates and ignore them. This seems to work pretty transparently for me. All I have to do is remember to check in any changes that the script appends to my global file. gitconfig file in a repo along with a lot of other global scripts and tools. gitconfig file with and header that imports the global file. ![]() gitconfig to the global one and then replaces all the text in the. Each time it is run it copies any settings that have been added to the user's. I solved this by writing the following PowerShell script and running it in my profile startup script. gitconfig file which replaces the link with a new file containing only the new settings. ![]() However, as pointed out by this does not survive any updates made by Git to the.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |