2018-06-26 08:03:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
SCRIPT_DIR=$(cd $(dirname ${0}); pwd)
|
|
|
|
|
2019-09-23 12:24:00 +00:00
|
|
|
. ${SCRIPT_DIR}/utils.sh
|
|
|
|
|
2018-06-26 08:03:58 +00:00
|
|
|
REPO_DIR=${SCRIPT_DIR}/simpleRepo
|
|
|
|
|
|
|
|
if [ ${#} -eq 1 ]; then
|
|
|
|
REPO_DIR=${1}
|
|
|
|
elif [ ${#} -gt 1 ]; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
declaim "Creating empty repository: ${REPO_DIR}"
|
|
|
|
rm -rf ${REPO_DIR}
|
|
|
|
mkdir -vp ${REPO_DIR}
|
|
|
|
cd ${REPO_DIR}
|
|
|
|
|
|
|
|
declaim "Initialising it as a git repository"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git init ${REPO_DIR}
|
2018-06-26 08:03:58 +00:00
|
|
|
|
2019-09-23 12:13:37 +00:00
|
|
|
declaim "Setting user.name and user.email for this local repository"
|
|
|
|
git_command git config --local user.name "\"Gaius Julius Caesar\""
|
|
|
|
git_command git config --local user.email gjcaesar@pontifexmaximus.rm
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Creating a text file"
|
|
|
|
cat <<EOF > information.md
|
|
|
|
|
|
|
|
# Test file
|
|
|
|
|
|
|
|
This is a file for demonstration purposes
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The first commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit1\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Updating the text file"
|
|
|
|
echo "This is a second line of information." >> information.md
|
|
|
|
echo >> information.md
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The second commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit2\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Updating the text file for the second time"
|
|
|
|
echo "This is a third line of information." >> information.md
|
|
|
|
echo >> information.md
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The third commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit3\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Creating and checking out the Rel1 branch"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git checkout -b Rel1
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Updating the text file on the Rel1 branch"
|
|
|
|
cat <<EOF >> information.md
|
|
|
|
|
|
|
|
# Rel1 information
|
|
|
|
|
|
|
|
This is more information added as part of Rel1
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The fourth commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit4\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Updating the text file on the Rel1 branch again"
|
|
|
|
mv -v information.md{,.hold}
|
|
|
|
cat information.md.hold | sed 's/of Rel1$/of Rel1./' > information.md
|
|
|
|
rm information.md.hold
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The fifth commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit5\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Creating and checking out the Rel2 branch"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git checkout master
|
|
|
|
git_command git checkout -b Rel2
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Updating the text file on the Rel2 branch"
|
|
|
|
mv information.md{,.hold}
|
|
|
|
cat <<EOF > information.md
|
|
|
|
|
|
|
|
# Rel2 information
|
|
|
|
|
|
|
|
This is more information added as part of Rel2
|
|
|
|
|
|
|
|
EOF
|
|
|
|
cat information.md.hold >> information.md
|
|
|
|
rm information.md.hold
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The sixth commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit6\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Updating the text file on the Rel2 branch again"
|
|
|
|
mv information.md{,.hold}
|
|
|
|
cat information.md.hold | sed 's/of Rel2$/of Rel2./' > information.md
|
|
|
|
rm information.md.hold
|
|
|
|
|
|
|
|
declaim "Adding and commiting that text file. The seventh commit"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git add information.md
|
|
|
|
git_command git commit -m "\"commit7\""
|
2018-06-26 08:03:58 +00:00
|
|
|
|
|
|
|
declaim "Checking out master"
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git checkout master
|
2018-06-26 08:03:58 +00:00
|
|
|
|
2019-09-23 12:13:37 +00:00
|
|
|
git_command git log --oneline --graph --decorate --all
|