Mike's Blog

The Official Git "Cheat Sheet"

Making git commits easier for all

August 19th 2015

Like many new to programming, I have found it difficult to remember the correct process to keeping my Git and Github act together. In this blog post I try to create a cheat sheet that should help in the learning process.

First off, why is git and GitHub Important? Using a VCS like Git/GitHub is critical to a developer not loosing their work. Think of it as a way to save your work and secure it in the cloud. In addition, it allows you to work collaboratively with teams by branching your code. In lamens terms it allows a team to work on the same files and then merge all the changes into a master copy.

Below is a quick description of the steps to go through the Git commit and GitHub push process in the command line. (Note: that you will need to have Git/Github set up on your computer first)

When you are ready to save your work:

1 - "git add" - This adds your work to a staging system which gets it ready for a commit. (you may want to add ".." after the "git add" to add all changes in the directory.)

2 - "git commit -m 'commit-message' " This commits your new work to git. Make sure to add a commit message of no more than 50 char and make it in the present tense.

3 - "git push origin 'branch-name' " This pushes your new branch to Github where you will have to review the pull request and merge into the Github master branch.

4 - "git fetch origin master" This updates the master with the new changes.