Created
June 14, 2019 14:02
-
-
Save chrisspen/e48c77852b52b5defb2948ef1a0628ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
[ -d /tmp/test ] && rm -Rf /tmp/test || true | |
mkdir -p /tmp/test | |
cd /tmp/test | |
git init | |
touch test.txt | |
echo "123" >> test.txt | |
echo "000" >> test.txt | |
echo "456" >> test.txt | |
echo "000" >> test.txt | |
echo "789" >> test.txt | |
cat test.txt | |
git add . | |
git commit -a -m "Initial commit" | |
git checkout -b staging | |
sed -i -e 's/456/abc/g' test.txt | |
cat test.txt | |
git commit -a -m "Added staging change." | |
git checkout master | |
git checkout -b hotfix | |
git merge staging | |
sed -i -e 's/789/xyz/g' test.txt | |
cat test.txt | |
git commit -a -m "Added hotfix change." | |
VALUE=`git rev-parse HEAD` | |
echo $VALUE | |
git checkout master | |
git cherry-pick $VALUE | |
cat test.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment