Add a script for restoring git
This commit is contained in:
parent
0ccc870584
commit
e064c3fd01
6 changed files with 24 additions and 11 deletions
8
scripts/Common/Config/git/flow/config.sh
Normal file
8
scripts/Common/Config/git/flow/config.sh
Normal file
|
@ -0,0 +1,8 @@
|
|||
git init;
|
||||
git commit --allow-empty -m "Initial commit" > /dev/null;
|
||||
git branch master || true;
|
||||
git branch main || true;
|
||||
git branch dev || true;
|
||||
yes "" | git flow init > /dev/null 2>&1;
|
||||
git flow config set --global master main > /dev/null;
|
||||
git flow config set --global develop dev > /dev/null;
|
8
scripts/Common/Config/git/flow/install.ps1
Normal file
8
scripts/Common/Config/git/flow/install.ps1
Normal file
|
@ -0,0 +1,8 @@
|
|||
$tempDir = Join-Path $([System.IO.Path]::GetTempPath()) $([System.IO.Path]::GetRandomFileName());
|
||||
$null = New-Item -ItemType Directory $tempDir;
|
||||
|
||||
Push-Location "$tempDir";
|
||||
. "$PSScriptRoot/config.sh";
|
||||
Pop-Location;
|
||||
|
||||
Remove-Item -Recurse "$tempDir";
|
|
@ -1,13 +1,6 @@
|
|||
#!/bin/bash
|
||||
contextRoot="$(mktemp -d)";
|
||||
pushd "$contextRoot" > /dev/null;
|
||||
git init;
|
||||
git commit --allow-empty -m "Initial commit" > /dev/null;
|
||||
git branch master || true;
|
||||
git branch main || true;
|
||||
git branch dev || true;
|
||||
yes "" | git flow init > /dev/null 2>&1;
|
||||
git flow config set --global master main > /dev/null;
|
||||
git flow config set --global develop dev > /dev/null;
|
||||
. "${BASH_SOURCE%/*}/config.sh";
|
||||
popd > /dev/null;
|
||||
rm -rf "$contextRoot";
|
||||
|
|
2
scripts/Common/Config/git/install.ps1
Normal file
2
scripts/Common/Config/git/install.ps1
Normal file
|
@ -0,0 +1,2 @@
|
|||
. "$PSScriptRoot/setup/install.sh";
|
||||
. "$PSScriptRoot/flow/install.ps1";
|
|
@ -60,6 +60,7 @@ function Invoke-WindowsRestore([Context] $context) {
|
|||
}
|
||||
|
||||
Invoke-FileRestore $context;
|
||||
Invoke-RestoreGit $context;
|
||||
|
||||
Remove-Item -Recurse $context.RootDir;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
. "$PSScriptRoot/../../Scripts/Context.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
$configBaseName = ".gitconfig";
|
||||
$configPath = Join-Path "$HOME" "$configBaseName";
|
||||
|
||||
function Invoke-BackupGit([Context] $context) {}
|
||||
|
||||
function Invoke-RestoreGit([Context] $context) {
|
||||
. "$PSScriptRoot/../../../Common/Config/git/install.ps1";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue