Based on our discussions about Git, branches, versioning, and troubleshooting
- Basic Git Commands
- Branch Management
- Version Control & Tags
- Reverting to Previous Versions
- Pushing & Pulling Changes
- Troubleshooting
- Picom & Kvantum Fixes (Bonus)
git initgit clone <repository-url>git statusgit add <file> # Add specific file
git add . # Add all changesgit commit -m "Your commit message"git log --oneline # Compact view
git log -p # Detailed changesgit branch # Local branches
git branch -a # All branches (local + remote)git checkout -b <branch-name> # Old syntax
git switch -c <branch-name> # New (Git ≥ 2.23)git checkout <branch-name>
git switch <branch-name>git branch -d <branch-name> # Safe delete (checks merges)
git branch -D <branch-name> # Force delete (unmerged changes)git push -u origin <branch-name> # First push (sets upstream)
git push # Subsequent pushesgit tag -lgit tag v1.0.0 -m "Release version 1.0.0"git push origin --tagsgit checkout v1.0.0git checkout -b <new-branch> v1.0.0git log --oneline # Copy the commit hash (e.g., `a1b2c3d`)git reset --soft a1b2c3dgit reset --hard a1b2c3d # ⚠️ Destructive! Use carefully.git revert a1b2c3d # Creates a new undo commitgit checkout -b rollback-branch v0.7.1git push origin <branch-name>git push --force origin <branch-name> # ⚠️ Use with caution!git pull origin <branch-name>git fetch origingit reflog # Find lost commits
git checkout HEAD@{1} # Restore- Open conflicted files and resolve manually.
- Mark as resolved:
git add <file>
git commitgit reset --soft HEAD~1 # Keeps changes staged
git reset --hard HEAD~1 # Discards changes- Always check
git statusbefore making changes. - Avoid
--forceon shared branches unless necessary. - Tags are immutable—use them for releases.
For advanced Git workflows, explore:
git stash(temporarily save changes)git rebase(rewrite commit history)git cherry-pick(copy specific commits)
Let me know if you need further clarifications! 🚀