git usage reminder
i seem to forget how to use git everytime i sit down to use it. admittedly, i don’t use it all that often, but i just really struggle keeping its “mental model” in my head.
so, to try to remind myself, here’s some info on how to use it:
- first off, you have to make sure your local ssh key is installed in git. i wasn’t able to get the tokens to work, but ssh definitely works and everyone seems to think this is easier overall anyway. here’s an article to read about how to do that setup: Setup SSH for GitHub
- once you’ve got ssh set up, you need to point git at the repo:
git remote set-url origin git@github.com:your-username/your-repo.git - test out that it’s working:
ssh -T git@github.com - if you are starting from scratch, and want to get the current state of a repo, that’s what clone is for:
git clone url-of-rep - if you add a new file to your repo, you’ll need to also add it to git:
git add .is the lazy way to do that. - once you have made a change somewhere, you need to create a commit:
git commit - finally, when you’ve got a commit out there and want to update the repo:
git push origin main
i’m going to keep updating this post (and probably changing the date on it as i do that) so you might see this post pop up a few times on the blog.