113 lines
3 KiB
Bash
Executable file
113 lines
3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
SCRIPT_DIR=$(cd $(dirname ${0}); pwd)
|
|
|
|
. ${SCRIPT_DIR}/utils.sh
|
|
|
|
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"
|
|
git_command git init ${REPO_DIR}
|
|
|
|
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
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit1\""
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit2\""
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit3\""
|
|
|
|
declaim "Creating and checking out the Rel1 branch"
|
|
git_command git checkout -b Rel1
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit4\""
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit5\""
|
|
|
|
declaim "Creating and checking out the Rel2 branch"
|
|
git_command git checkout master
|
|
git_command git checkout -b Rel2
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit6\""
|
|
|
|
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"
|
|
git_command git add information.md
|
|
git_command git commit -m "\"commit7\""
|
|
|
|
declaim "Checking out master"
|
|
git_command git checkout master
|
|
|
|
git_command git log --oneline --graph --decorate --all
|