Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

Git Cheat Sheet - Part 1

I have decided to do a compilation of git commands I use everyday to make up a cheat sheet. Git is open source distributed version control system that facilitates GitHub activities on your laptop or desktop. This cheat sheet summaries commonly used Git command line instructions for quick reference.

Configure Tooling
Configure user informatioon for all local repositories

$ git config --global "[name]"

Set the name you want attached to your commit transactions

$ git config --global "[email address]"

Set the email you want to attach to your commit transactions

$ git config --global color.ui auto

Enables helpful colorisation of command line output

Create Repositories
Start a new repository or obtain one from an existing URL

$ git init [project-name]

Creates a new local repository with the specified name

$ git clone

Downloads a project and its entire version history

Make Changes
Review edits and craft a commit transaction

$ git status

Lists all new or modified files to be committed

$ git diff

Show file differences not yet staged

$ git add [file]

Snapshots the file preparation for versioning

$ git diff --staged

Shows file differences between staging and the last file version

$ git reset [file]

Unstages the file but preserve its contents

$ git commit -m "[descriptive message]"

Records file snapshots permanently in version history

Group Changes
Name a series of commits and combie completed efforts

$ git branch

List all local branches in the current repository

$ git branch [branch-name]

Creates a new branch

$ git checkout [branch-name]

Combines the specified branch's history into the current branch

$ git merge [branch]

Switches to specified branch and updates the working directory

$ git branch -d [branch-name]

Deletes the specified branch

Stash Changes

Stash changes

$ git stash

List Stashed Changes

$ git stash list

Delete Stash (0 represents Stash ID)

$ git stash drop stash@{0}

Hope this is helpful.

comments powered by Disqus