Skip to content

Instantly share code, notes, and snippets.

@jburwell
Created February 2, 2016 10:50
Show Gist options
  • Select an option

  • Save jburwell/b06a68193c8f46f41e14 to your computer and use it in GitHub Desktop.

Select an option

Save jburwell/b06a68193c8f46f41e14 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
MAINT_BRANCH="maint"
create_random_file() {
head -c $2 /dev/urandom > $1
}
echo "Cleanup from previous test runs ..."
rm -rf *.txt
rm -rf .git
echo "Init a new git repo ..."
git init
echo "Create a couple of files for master..."
create_random_file foo.txt, 25500
create_random_file bar.txt, 5000
echo "Commit the files to master ..."
git add .
git commit -m "Initial import"
echo "Check out a ${MAINT_BRANCH} ..."
git checkout -b "${MAINT_BRANCH}"
echo "Create a file for ${MAINT_BRANCH}"
create_random_file zoo.txt, 10000
git add .
git commit -m "Adds zoo.txt to ${MAINT_BRANCH} ..."
git checkout master
echo "Create another two commits for master ..."
create_random_file goo.txt, 12000
git add .
git commit -m "Adds goo.txt to master"
create_random_file hoo.txt, 11100
git add .
git commit -m "Adds hoo.txt to master"
echo "Merge one commit back of master to ${MAINT_BRANCH}"
git checkout "${MAINT_BRANCH}"
git merge master~1 -m "Merging goo.txt to ${MAINT_BRANCH}"
git branch --contains master~1
@DaanHoogland

Copy link
Copy Markdown

how about creating a git-backport with an automated version of the procedure and add it to the repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment