Version-Control


Nov. 28, 2025

Local-Only Git Workflow Guide

What I Learned

I organized a workflow for using Git solely locally, without using remotes like GitHub, aimed at Git beginners and individual developers. Since Git inherently keeps all history locally, understanding local Git before learning about remotes makes it easier to handle and less confusing. Backups (pseudo-remote/mirror) are possible even within local environments.

Details

Benefits of Using Git Locally Only

  • Fewer concepts to learn, easier to study
  • No risk of bothering others
  • Can focus on Git’s essence (managing change history)

1. Basic Operations and Workflow

1-1. Repository Creation and Status Checks

1git init
2git status

1-2. Recording Changes Flow

1git add .
2git commit -m "work description"

1-3. Checking Status and History

1git diff
2git log --oneline --graph --decorate

1-4. Branch Operations

1git switch -c feature
2git switch main
3git branch -d feature

2. Reverting to Past Versions (Recovery Commands)

2-1. Restore Files Only

1git restore filename

2-2. Undo the Last Commit (Keep Work Contents)

1git reset --soft HEAD^

2-3. Rewind Commits and Changes (Destructive)

1git reset --hard HEAD^

2-4. Revert to a Specific Commit

1git reset --hard <commit-id>

2-5. Undo Without Breaking History

1git revert <commit-id>

2-6. Reference Past State

1git switch --detach <commit-id>

3. Backup (Local Pseudo-Remote + Mirror)

Git “remotes” don’t have to be URLs; you can register local folders as remotes.

Nov. 5, 2025

Git Rebase Interactive

What I Learned

Git’s interactive rebase (git rebase -i) is a powerful tool for cleaning up commit history before pushing changes. It allows you to reorder, squash, edit, or remove commits.

Details

Interactive rebase opens an editor with a list of commits and commands:

1git rebase -i HEAD~3

Available commands:

  • pick - use commit as-is
  • reword - change commit message
  • edit - stop for amending
  • squash - combine with previous commit
  • fixup - like squash but discard commit message
  • drop - remove commit

Example workflow: