Skip to content

Git Cheat Sheet

George Robertson edited this page Nov 29, 2019 · 10 revisions

The below git commands have taken from an online cheat sheet. The commands can be entered into GitBash/Command prompt.

GitClone

$ git clone [URL] 

Retrieve an entire repository from GitHub via URL

GitBasics

$ git branch 

List your branches. a * will appear next to the currently active branch.

$ git checkout

Switch to another branch and check it out into your working directory.

$ git pull

Fetch and merge any commits from the tracking remote branch.

$ git add .
$ git add --patch

Add a file as it looks now to your next commit (stage).

$ Git commit -m “[descriptive message]"

Commit your staged content as a new commit snapshot.

$ git push [alias][branch]

Transmit local branch commits to remote repository branch.




This is not an exhaustive document of the most common GitBash commands. If there are any you use frequently that have been missed additions are welcomed.

Clone this wiki locally