WARNING: This is a quick spiel, with lots of Marie Kondo gifs incorporated..
These are git commands I've learned along the way that I wish I would've known since day one! I hope they're helpful for anyone just getting started with git or wanting to manage their workflow a lil' better.
I'd say, when trying to be more organized, and especially when you're working with a group of people, you really have to ask yourself one thing... DO MY COMMITS SPARK JOY? If that's not the case, these might be some useful commands for you:
// add changes to last commit and keep original commit message git add . && git commit --amend --no-edit // edit your last commit message git commit --amend -m "edited commit message"
Git branch basically just allows you to make a copy of your master code, and work from that copy. When you're ready, you can merge this new branch to master.
git checkout -b <branch_name> // create new branch & switch to it git checkout <branch_name> // switch to another branch git push origin <branch_name> // push to github git merge <branch_name> // combine branch changes to master
Going back to see what you've done is always super helpful, and just a way for you to be mindful of the changes that you're making.
git log //general summary of your previous commits git log --oneline //shows your last commit git reflog //to see entire history i.e. any redos, rebases
a blogpost by Gabriel Abud :
Are there any git commands you wish you'd known about when you were just starting?