What Is GitHub?

I started using GitHub for my Crafting Digital History course for the first time this year. At the time, I had never heard of GitHub, and I found its terminology and commands difficult to understand. However, once you download all the necessary software and begin using its commands, it is quite simple to use. It is also useful to learn, as social coding through GitHub has become increasing popular, and currently the site is home to more than 5 million open source projects.

GitHub is a code hosting website which is used to create and share projects on its server. It allows individuals to easily keep track of the changes made to their work, including the changes others have made to their projects while engaging in collaborations. It’s companion, GitHub Desktop, allows you to make contributions and changes to a project locally—meaning on your computer, as oppose to remotely, which means on the GitHub server. In particular, this can be useful for individuals who wish to create projects through collaboration, as it gives you the freedom to develop and implement changes to a copy of a folder locally, and then merge all collaborations to the original folder on the GitHub server. As part of GitHub Desktop, Git is a version control program which tracks the changes made to your projects.

Some Key Terms:

image

Some Useful Git Commands:

  • git init <directory> To turn an existing project’s directory into a Git repository
  • git status To check the status of a repository ex: results on branch master and nothing to commit tells you the location of the repo and its changes respectively
  • git diff To view differences between commits for your file
  • git add Asks Git to start tracking new files
  • git commit -a For Git to record changes in all tracked files
  • git commit -m <commit-message> Tells Git to take a “snapshot” of the current repo. This command is also for providing a commit message, which is a reminder to yourself stating the reason for the committed changes ex: correction to hello file
  •  git checkout -b <new-branch-name> For creating new branches. Creating branches can be useful for editing or colaborating on a project to make desired changes, and later merging changes to the master branch
  • git push origin <new-branch-name> Tells Git to push, or send, the repository from the master branch to the newly created branch so that you may edit locally
  • git pull origin <master-branch-name> to sync master changes into your branch
  • git diff master...<branch-name> To compare the changes in files under the branch to the original files under the master
  • .gitignore To tell Git to ignore specific files you do not want to be tracked ex: files with passwords
  • git rm <FILE.md> To tell Git to remove a file from tracked files

Some Exercises To Get Started:

If you are interested in learning more, you can explore Github to get a sense of how it can be used to host a wide variety of projects. If you would like to try GitHub, they offers a variety of tutorials and tips on how to understand using its site. I also recommend Code School, which is an online learning website which offers a variety of free courses on programs and basic coding, including Git. An example of what this Git tutorial looks like can be seen below.

Setting Up Your GitHub Space:

Git-It is an interactive tutorial designed to teach the basics of Git and GitHub.  This tutorial shows you how to download and install all of the software needed to complete the tutorial and use GitHub. As part of the Git-It challenges, you will set up your own GitHub account and create real repositories and contributions in GitHub. This is a great way to learn GitHub, I found this tutorial especially useful in my course as I could simply refer back to my repositories to remember how to make new contributions and repositories for a separate project.

image