Github Cheatsheet
Github Cheatsheet
Github Cheatsheet
Git is the free and open source distributed version control system that's responsible for everything GitHub
related that happens locally on your computer. This cheat sheet features the most important and commonly
used Git commands for easy reference.
Git for All Platforms diff of what is changed but not staged
http://git-scm.com
git diff --staged
set a name that is identifiable for credit when review version history
git config --global user.email “[valid-email]”
BRANCH & MERGE
Isolating work in branches, changing context, and integrating changes
set an email address that will be associated with each history marker
git branch
git config --global color.ui auto
list your branches. a * will appear next to the currently active branch
set automatic command line coloring for Git for easy reviewing
git branch [branch-name]
initialize an existing directory as a Git repository merge the specified branch’s history into the current one
git clone [url] git log
retrieve an entire repository from a hosted location via URL show all commits in the current branch’s history
INSPECT & COMPARE SHARE & UPDATE
Examining logs, diffs and object information Retrieving updates from another repository and updating local repos
show the commit history for the currently active branch add a git URL as an alias
git log branchB..branchA git fetch [alias]
show the commits on branchA that are not on branchB fetch down all the branches from that Git remote
git log --follow [file] git merge [alias]/[branch]
show the commits that changed file, even across renames merge a remote branch into your current branch to bring it up to date
git diff branchB...branchA git push [alias] [branch]
show the diff of what is in branchA that is not in branchB Transmit local branch commits to the remote repository branch
git show [SHA] git pull
show any object in Git in human-readable format fetch and merge any commits from the tracking remote branch
delete the file from project and stage the removal for commit apply any commits of current branch ahead of specified one
change an existing file path and stage the move clear staging area, rewrite working tree from specified commit
show all commit logs with indication of any paths that moved TEMPORARY COMMITS
Temporarily store modified, tracked files in order to change branches
system wide ignore pattern for all local repositories discard the changes from top of stash stack
Education
Teach and learn better, together. GitHub is free for students and teach- [email protected]
ers. Discounts available for other educational uses. education.github.com
Git Cheat Sheet
$ git commit
Create a new commit from changes added to the staging area.
The commit must have a message!
at git-scm.com/book. Repository
Git commit
C Ignoring Files This is an origin/fix/a fix/a This is a local branch. It is 3 commits ahead,
upstream branch you see it, right?