Git Workflows
Create feature branch
git checkout -b feature/new-feature
Push feature branch
git push -u origin feature/new-feature
Delete local feature branch
git checkout main
git pull
git branch -d feature/new-feature
Undo last commit (keep changes)
Change last commit message
git commit --amend -m "New message"
Unstage file
git restore --staged <file>
Discard local changes
Add upstream remote
git remote add upstream <original-repo-url>
Sync fork
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
Rebase feature branch
git checkout feature/branch
git rebase main
Interactive rebase
Cherry pick commit
git cherry-pick <commit-hash>