In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:
- You can separate the code into different repositories.
function main { | |
Update-Windows-Configuration | |
Install-Utils | |
Install-Browsers | |
Install-Fonts |
# git get last month commit | |
function Get-GitCommit { | |
[CmdletBinding()] #<<-- This turns a regular function into an advanced function | |
param ( | |
$dateString | |
) | |
Import-Module ".\psake\psake-v4.00\psake.psm1" -verbose -force -passthru | |
$nugetServerUrlPrerelease = "https://nuget.prerelease" | |
Write-Host "Update prerelease" | |
Write-Host "feed alpha : $nugetServerUrlPrerelease" | |
$packages = "Package1", "Package2" | |
$versionname = "4.8.0-alpha-JIRA-1000." |
$versionname = "4.8.0-alpha-JIRA-1000." | |
$version = "$versionname.50" | |
$packages = "SaiAdNet", "Sai.Core", "Sai.Infra.Cqs", "SaiAdNet.Core", "SaiAdNet.Data", "SaiAdNet.DataProvider" | |
$file = "D:\Git\sai-sharp-feature\SaiSharp.AdNetIntegration\packages.config" | |
[xml]$XmlDocument = Get-Content -Path $file |
# encrypt files to utf-8 no bom | |
[string[]]$Excludes = @('**\\Debug\\**', '**\\bin\\**', '**\\obj\\**', '*TemporaryGeneratedFile*.cs', '*.Designer.cs') | |
$files = Get-ChildItem -Include *.aspx, *.asmx, *.cs -Exclude $Excludes -Recurse -Path . | select FullName, @{n='Encoding';e={Get-FileEncoding $_.FullName}} | |
$files.count |
# the purpose of the script was to do a backup of all the repositories in a bitbucket team locally | |
# you can add this script in a scheduler daily or a teamcity build get a backup locally of all source code | |
# the following script connect to bitbucket.org to get all team repositories | |
# it does a foreach to clone new repository or fetch, pull existing one | |
# use auth2 to get a token | |
# https://developer.atlassian.com/cloud/bitbucket/oauth-2/ | |
# adapt the following script by | |
# 1- connect to your bitbucket account and create an auth consumer Key:Secret, give the read access to the project | |
# 2- create also an app password |
# encrypt files to utf-8 no bom | |
[string[]]$Excludes = @('**Debug**', '**bin\**', '*TemporaryGeneratedFile*.cs', '*.Designer.cs') | |
Get-ChildItem . -recurse -Include *.aspx, *.master, *.cs -Exclude $Excludes | ForEach-Object { | |
$content = $_ | Get-Content | |
$Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False | |
$_.Fullname |
<# | |
.SYNOPSIS | |
Converts files to the given encoding. | |
Matches the include pattern recursively under the given path. | |
.EXAMPLE | |
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8 | |
#> | |
function List-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') { | |
$count = 0 |