how to stage changes and write commits that actually make sense
git add .stages everything in the current directory. convenient but be careful — use git status first so you don't accidentally add junk.
git add -pinteractive staging. goes through each diff hunk and asks if you want to stage it. good when you've changed a bunch of stuff and want clean, focused commits instead of one giant blob.
git commit -m "your message here"basic commit. write messages that describe why, not just what.
git commit --amendrewrites the last commit. use it to fix a typo in your message or add a file you forgot. don't amend after you've pushed unless you're okay with force-pushing.
git stashshelves your current changes so you can switch context. nothing gets committed, just saved off to the side.
git stash popbrings those changes back. if you have multiple stashes, git stash list shows them and git stash pop stash@{1} lets you pick one.