Here are some great resources for learning how to use Git and GitHub. There’s more here than any one person will need, so just learn what will be helpful to you in the very near future.

  1. Watch these short videos: Version control with Git and GitHub by freeCodeCamp.
  2. Check out Better Explained’s guides to version control and Git, or the Learn X in Y minutes guide to Git.
  3. Consider starting with a Git client with a graphical interface, such as GitHub Desktop, GitButler, or Sublime Merge. They make the most commonly used features of Git easier to use without preventing you from learning more about Git.
  4. Read some of this free online book, but only the parts that you will use very soon: Pro Git by Scott Chacon and Ben Straub.
  5. Bookmark Dangit, Git!?! for when you make mistakes with Git.
  6. How to Write a Git Commit Message by cbeams.
  7. What are some examples of commonly used practices for naming git branches? - Stack Overflow

Git workflows

There are many different workflows that can be used with Git. A great example is GitHub flow, by GitHub. A workflow I sometimes use is very similar:

  1. Use git pull to make sure your local copy of the code is up-to-date.
  2. Create a new branch with a descriptive name and git switch to the branch.
  3. Make commits on your branch.
  4. When your commits are ready to be merged into the main branch, use git fetch and then git status to make sure your local copy of the code is up-to-date. If not, switch to the main branch, pull, switch to your branch, and either rebase or merge the main branch into your branch (merge if commit order matters, rebase otherwise).
  5. Push your branch.
  6. Make and accept a pull request on GitHub between the two branches.
  7. Delete your branch both locally and on GitHub.

When you’re waiting for a pull request to be approved but have more work to do, create a new branch off the unmerged branch, not main.

Another example of a Git workflow with a different use-case is covered in A successful Git branching model by Vincent Driessen.

further reading

alternatives to GitHub

alternatives to Git