Skip to content

Instantly share code, notes, and snippets.

@l0b0
Created July 31, 2012 14:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save l0b0/3217470 to your computer and use it in GitHub Desktop.
Save l0b0/3217470 to your computer and use it in GitHub Desktop.
Simple merge example
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
cd "$(mktemp --directory)"
git init
cat > test.txt <<EOF
alfa
bravo
charlie
delta
echo
foxtrot
golf
hotel
india
juliet
kilo
lima
mike
november
oscar
papa
quebec
romeo
sierra
tango
uniform
victor
whiskey
x-ray
yankee
zulu
EOF
git add test.txt
git commit --message "Initial commit"
git branch --track experiment
git checkout experiment
sed --in-place --expression 's/alfa/abraham/' test.txt
git commit --all --message "Experiment successful"
cat >> test.txt <<EOF
one
two
three
four
five
six
seven
eight
nine
EOF
git commit --all --message "Added numbers"
git checkout master
sed --in-place --expression 's/alfa/alpha/' test.txt
cat >> test.txt <<EOF
ærlig
østen
åse
EOF
git commit --all --message "Norwegian"
git rebase experiment || git mergetool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment