Skip to content

Git Restore Points

This page documents the local Git restore point workflow for Magikal.

Purpose

Git restore points give us a safe checkpoint before editing live project files.

Use them before:

  • large feature changes
  • multi-file edits
  • database/migration work
  • panel layout changes
  • bot cog refactors
  • risky fixes
  • anything that would be annoying to manually undo

Project repositories

Project Path
Discord bot /home/magikalbot/magikal-bot
Web panel /home/magikalbot/magikal-panel
Documentation /home/magikalbot/magikal-docs

Check current status

Bot:

cd /home/magikalbot/magikal-bot
git status

Panel:

cd /home/magikalbot/magikal-panel
git status

Docs:

cd /home/magikalbot/magikal-docs
git status

Good output:

On branch master
nothing to commit, working tree clean

Create a restore point

Use a clear commit message that says why the checkpoint exists.

Bot:

cd /home/magikalbot/magikal-bot
git add .
git commit -m "restore point before planned bot change"

Panel:

cd /home/magikalbot/magikal-panel
git add .
git commit -m "restore point before planned panel change"

Docs:

cd /home/magikalbot/magikal-docs
git add .
git commit -m "restore point before planned docs change"

Check recent commits

git log --oneline --max-count=10

See what changed before committing

Short summary:

git status --short

File-level diff:

git diff --stat

Full diff:

git diff

Staged diff:

git diff --cached

See what changed in the last commit

git show --stat
git show --name-only

Safe rollback thinking

Do not panic-reset live files.

Before rolling anything back, check:

  • which project you are in
  • what branch you are on
  • what changed
  • whether the bad change has already been committed
  • whether database migrations were involved
  • whether the service has been restarted since the change

Red flags

Stop and ask for help before rollback if:

  • the change involved Alembic migrations
  • the change touched database models
  • the bot is partly working and partly broken
  • uncommitted work exists
  • you are unsure which commit is safe
  • multiple projects changed at once

Useful safety commands

Show current folder:

pwd

Show Git status:

git status

Show recent commits:

git log --oneline --max-count=10

Show changed files:

git status --short

Show current branch:

git branch --show-current

Rule

Before any wide or risky change, create or confirm a Git restore point first.