Git Workflows & Daily Operations
Curated workflows for daily Git operations, worktrees, branch synchronization, and commit inspection.
Branch Synchronization
Syncing with Upstream Master/Main
Fetch updates from the remote and rebase local commits cleanly on top:
git fetch origin
git rebase origin/masterPull with Rebase
Avoid unnecessary merge commits when updating local feature branches:
git pull --rebaseIf merge conflicts arise during rebase and you need to abort:
git rebase --abortGit Worktree
Worktrees allow having multiple working branches checked out simultaneously in separate directories without multiple clones.
Bare Clone Setup
git clone --bare <repository-url> .bareAdding a Worktree for an Existing Branch
git worktree add <path> <branch>Adding a Worktree with a New Branch
git worktree add <path> -b <new-branch> <base-branch>Listing and Removing Worktrees
git worktree list
git worktree remove <path>Log Inspection & Graph Visualization
Graphical Single-Line History
git log --graph --pretty=onelineFull Branch Graph with Decorations
Display all branches, tags, and commits in an ASCII graph:
git log --graph --decorate --all --onelineSuppress Commit Notes
git log --no-notesHistory Rewriting & Reverting
Interactive Rebase
Rebase and clean up the last n commits:
git rebase -i HEAD~nReverting Commits
Create a new commit that reverses changes from a previous commit:
git revert <commit-hash>Deleting Tags
Remove local and remote tags:
# Delete local tag
git tag -d <tag-name>
# Delete remote tag
git push origin --delete <tag-name>