Show Menu
Cheatography

Working Directory -> git add -> staging -> git commit -> local -> git push -> remote

Git Status

Displays the state of the working directory and the staging area
Files in the working directory:
listed under "­Changes not staged for commit­"
Files in the staging area:
Listed under "­Changes to be commit­ted­"
Files in the local repo:
Nothing to commit (working directory clean)

Working Directory <-> Staging

Working Directory -> git add -> Staging
Working Directory <- git checko­ut/­merge <- Staging
Working Directory <- git diff -> Staging

Making changes

Add file to stage
git add fileName
Add all files to stage
git add .

Evaluate changes

diff of what is changed but not staged
git diff --

Branches

List all branches
git branch
Add a branch
git branch NameOf­New­Branch
Switch to specified branch in working directory
git checkout -- BranchName
Join specified [from name] branch into your current branch (the one you are on currently)
git merge -- fromName
show all commits in the current branch’s history
git log
 

Staging <-> Local Repo

Staging -> git commit -> Local Repo
Staging <- git reset <- Local Repo
Staging <- git diff --staged -> Local Repo

Committing to remote

Move all staged files to git remote repo
git commit -m 'message'
Move all staged files to git remote repo
git commit -am 'message'

Reverting changes

Unstage a file while retaining the changes in working directory
git reset fileName
diff of what is staged but not yet commited
git diff --staged

Start Project

Create Project
git init direct­oryName
Download remote repo
git cline ulrName
 

local <-> remote

local -> git push -> remote
local <- git pull/fetch <- remote

Remote to local

Git fetch
Bring down all branches from Git remote
Git pull
Fetch and merge commits from remote branch

Local to remote

git push
Transmit local branch commits to the remote repository branch
           
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Bash Dev Cheat Sheet
          Linux Cheat Sheet
          Common Commands Cheat Sheet

          More Cheat Sheets by datamansam

          Jupyter Notebook Keyboard Shortcuts
          Numpy Crib Cheat Sheet
          DataBase Concepts Cheat Sheet