Created
July 12, 2019 10:40
-
-
Save fcostin/cb892ccd9cbab2a4b041f0e13467394f to your computer and use it in GitHub Desktop.
git_trivia.sh
This file contains hidden or 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 -x -e | |
# In the beginning there was nothing, just hopes, dreams, | |
# a modest development budget. | |
mkdir -p demo | |
cd demo | |
git init . | |
# Then there was the initial commit | |
echo "hello app world" > app | |
git add app | |
git commit -m "initial commit" | |
# Then there was an MVP: | |
echo "mvp" >> app | |
git add app | |
git commit -m "implement mvp" | |
# The MVP was not Good, but it was released anyway. | |
# Our heroes had the discipline to tag the version they released: | |
git tag "release/0" | |
# A new feature was designed and developed incorporating the | |
# knowledge gained from watching the users' optimistic attempts | |
# to use the MVP | |
echo "amazing new feeture" >> app | |
git add app | |
git commit -m "add amazing new feature" | |
# The new version with the new feature was released. | |
# Our brave heroes are getting some rhythm going now. | |
# Look at that cycle time. | |
# Again, the release was tagged for traceability: | |
git tag "release/1" | |
# But alas: the amazing new feature injected a bug that was | |
# not discovered before it was inflicted upon the users! | |
# Our brave heroes scramble to prepare a hotfix release: | |
git checkout "release/1" | |
git checkout -b hotfix | |
sed -i "s/feet/feat/g" app | |
git add app | |
git commit -m "apply emergency patch" | |
# The hotfix is ready on a feature branch. | |
# Our heroes merge the hotfix atop the existing "release/1" ! | |
git merge "release/1" | |
# Again, for traceability, they tag the hotfix release: | |
git tag "release/1.1" | |
# Phew! Close one! Good work. | |
# Now, within the context of the above example, here are some git trivia questions: | |
# | |
# Q1 (1 point) Does the commit pointed to by "release/1" contain the emergency fix? (Yes/No) | |
# | |
# Q2 (2 points) Explain the reasoning behind your answer to Q1. | |
# | |
# Q3 (1 point) Does the above behaviour make you happy? (Yes/No) | |
# | |
# Q4 (2 points) Explain what assumptions would need to change for you to give the | |
# opposite answer to question Q1. Or explain why this is not possible. | |
# | |
# Q5 (1 point) Does the commit pointed to by "release/1.1" contain the emergency fix? (Yes/No) | |
# | |
# Q6 (2 point) Explain the reasoning behind your answer to Q5. | |
# | |
# Q7 (bonus 1 point) If you do these kinds of operations via the Github UI, rather than via the Git | |
# command line interface, do you get the same result? Explain your reasoning. | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment