There's only a few git commands I use often enough that I have them memorized. I've used others, but I have to lookup their syntax and what they do.
git clone [url]
Grabs a remote repo (usually a github repo url for me) and fetchs all the files to the local system
git clone https://github.com/elijahc/MyRepo
git status
Displays the changes to any files its noted in the repo.
This is how I tell what I (or any tooling that modifies files) have changed
git add [path]
Once you're happy with your changes this is how you tell git what changes you want to commit to the repo. This is also called "staging" your changes.
You can do this one file at a time:
git add file1.txt
git add file2.txt
git add path/to/file3.txt
A directory at a time
git add folder/
or
git add path/to/folder/
Or literally ALL changes its noticed
git add .
In theory large batch changes like this are not recommended, but I won't say I haven't done it.
git commit -m 'this is my commit message'
Once you've staged all the changes you want to commit using git add you usually label them with some kind of message that describes the changes you made
git push [remote] [branch]
Executing git commit will commit the changes to your local instance of the git repository but will not sync or send them anywhere.
You almost always need to do that if you're triggering build and deploys with github, or collaborating with anyone else and you want them to have your changes
git push "synchronizes" your changes with a remote server hosting the git repository (usually github)
A local repo can push to multiple different remote hosts so you need to indicate what remote host with the first argument.
If you clone the original repo from a url git automatically creates a reference to that remote called 'origin'
git push origin master
or
git push origin mainRepositories can have multiple branches that you might want to synchronize commited changes but a lot of people just use a single one, usually named main or master
git pull
If you have a repository that is outdated relative to the remote, say if someone else has made updates, you update your local repo using This pulls any new commits/changes you don't already have.
Will explain these later...