PeterSmith.Org

Git to it


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 Github, where those changes are notified to Netlify which drags them out and runs Hugo to make this site.

Here are some shortened notes on git based on the very helpful guide at 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

git add or git add *

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

git pull

in your working directory to fetch and merge remote changes.

If you webmention this page, please let me know the URL of your page.

BTW: Your webmention won't show up until I next "build" my site.

Show all the shares aka https://keithjgrant.com/posts/2019/01/low-friction-workflow-for-notes/