Skip to content

Instantly share code, notes, and snippets.

@tkirill
Created May 22, 2015 13:16
Show Gist options
  • Save tkirill/6dd2606d1ae8b9b1e0f5 to your computer and use it in GitHub Desktop.
Save tkirill/6dd2606d1ae8b9b1e0f5 to your computer and use it in GitHub Desktop.
Setup test rig for Remove-MergedGitBranches
if (Test-Path test) {
rm -force -r test
}
if (Test-Path test-clone) {
rm -force -r test-clone
}
if (Test-Path test-clone2) {
rm -force -r test-clone2
}
git init test
cd test
# Initial commit to master
echo 1 > 1.txt
git add 1.txt
git commit -m 'commit 1'
# Branch1
git checkout -b branch1
echo 2 > 2.txt
git add 2.txt
git commit -m 'commit 2'
# Branch2
git checkout master
git checkout -b branch2
echo 3 > 3.txt
git add 3.txt
git commit -m 'commit 3'
# Merge branch2
git checkout master
git merge branch2
# Clone to test-clone
cd ..
git clone test test-clone
cd test-clone
git checkout branch2 # branch2 is local merged branch now
git checkout master
cd ..
# Clone to test-clone2
git clone test test-clone2
cd test-clone2
git checkout branch2 # branch2 is local merged branch now
git checkout master
git remote add other ..\test-clone # now we have to remotes
git fetch other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment