I use git for a few things, but the most important is part of my workflow for this blog. I push changes–e.g., update content–to https://github.com, where those changes are noticed by https://netlify.com which drags them out and runs https://gohugo.io/ to make this site.
Here are some shortened notes based on the very helpful https://rogerdudler.github.io/git-guide/.
To checkout a repository
Create a working copy of a local repository by running the command
git clone /path/to/repository
When using a remote server, your command will be
git clone username@host:/path/to/repository
To add and commit
You can propose changes (add it to the Index) using
This is the first step in the basic git workflow. To actually commit these changes use
git commit -m “Commit message”
Now the file is committed to the HEAD, but not in your remote repository yet.
To push changes
Your changes are now in the HEAD of your local working copy. To send those changes to your remote repository, execute
git push origin master
Change master to whatever branch you want to push your changes to.
If you have not cloned an existing repository and want to connect your repository to a remote server, you need to add it with
git remote add origin
Now you are able to push your changes to the selected remote server
To update & merge
To update your local repository to the newest commit, execute
in your working directory to fetch and merge remote changes.