Useful Git Commands
A collection of Git commands I frequently use
Useful Git Commands
Here's a collection of Git commands I find myself using frequently.
Daily Commands
# View status
git status
# Create and switch to new branch
git checkout -b feature/new-branch
# Stage all changes
git add .
# Commit with message
git commit -m "feat: add new feature"
Advanced Commands
# Interactive rebase
git rebase -i HEAD~3
# Force push safely
git push --force-with-lease
# Clean untracked files
git clean -fd
Tips
- Always use
--force-with-leaseinstead of--force - Use conventional commit messages
- Keep commits atomic and focused