Skip to content

Instantly share code, notes, and snippets.

@christophberger
Created August 9, 2024 15:20
Show Gist options
  • Save christophberger/612728e5a1e4867a2688fee77ffbe3f7 to your computer and use it in GitHub Desktop.
Save christophberger/612728e5a1e4867a2688fee77ffbe3f7 to your computer and use it in GitHub Desktop.
Graphite Demo Verification Script
#!/usr/bin/env bash
# This script runs all steps from the article.
#
# If the folder "graphite-demo" exists,
# it trashes this folder and deletes the repo on GitHub.
MMDD=$(date "+%m-%d")
# cleanup
if [ -d "graphite-demo" ]; then
trash graphite-demo
fi
if [ $(gh repo list christophberger-articles | grep graphite-demo | wc -l) = 1 ]; then
gh repo delete christophberger-articles/graphite-demo
fi
# run the steps
gh repo create christophberger-articles/graphite-demo --private --clone
cd graphite-demo || exit 1
echo frontend >frontend.js
echo server >server.go
echo database >database.go
git add -A
git commit -m "initial commit"
git push
gt init
echo gt init completed
gt ls
gt sync
echo gt sync completed
echo statistics page db layer >>database.go
echo commit changes and create a PR
git add -A
gt create --message "feat (DB): Add statistics view"
echo DB branch
gt log
echo statistics page handler >>server.go
gt create --all --message "feat (server): Add statistics view"
echo server branch
gt log
echo statistics page interactions >>frontend.js
gt create --all --message "feat (frontend): Add statistics view"
echo frontend branch
gt ls
echo gt checkout main
gt checkout main
echo someone changed the style >frontend.css
git add frontend.css
echo git commit
git commit -am "feat (frontend): add new CSS file"
echo git log after change in main
git log --graph --simplify-by-decoration --pretty=format:'%d' --all
echo gt checkout frontend
gt checkout "$MMDD-feat_frontend_add_statistics_view"
echo after checking out the frontend PR branch
gt ls
echo restack
gt restack
echo after restack
gt ls
echo gt checkout db
gt checkout "$MMDD-feat_db_add_statistics_view"
echo fix the db code >>database.go
echo gt modify
gt modify -a
echo modified db branch
gt ls
echo gt checkout server
gt checkout "$MMDD-feat_server_add_statistics_view"
echo alternate stats view >server.go
echo gt create
gt create --insert --all --message "feat (server): add alternate stats view"
echo inserted alternate stats view
gt ls
echo checkout top branch
gt checkout "$MMDD-feat_frontend_add_statistics_view"
echo gt submit
gt submit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment