Created
October 19, 2011 11:15
-
-
Save pcx/1298007 to your computer and use it in GitHub Desktop.
Basic git command reference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git status -s | |
first column --> shows difference between committed and staged | |
second column --> shows difference between staged and unstaged | |
git diff --> changes between staged and unstaged | |
git diff --cached --> diff between committed and staged changes | |
git diff HEAD --> diff between committed and unstaged | |
--stat --> shorter summary of changes | |
git commit --> commits all staged changes | |
git commit -a --> commits all changes for all tracked files | |
git reset HEAD -- file-name | |
Unstage all staged changes for a file | |
git rm --> removes file from staging area and also deletes the file | |
git rm --cached --> removes the file from staging area but leaving it on the hard disk | |
git branch --> lists all branches | |
git branch branchname -->creates a new branch | |
git checkout branchname --> switch to a new branch | |
git checkout -b branchname --> create a new branch and shift to it | |
git branch -d branchname --> delete a branch | |
git log | |
git log --oneline | |
git log --oneline --graph | |
git log --oneline branch1 ^branch2 --> logs in branch1 and not in branch2 | |
git tag -a --> add an annotated tag | |
git tag -a commit-SHA --> tag a specific commit | |
git remote --> list remotes | |
git remote -v --> list remotes verbosely | |
git remote add <remote-name> git@github.com:<username>/<reponame>.git --> add a github remote | |
git remote rm remote-name --> delete a remote | |
git fetch remote-name | |
git pull remote-name = git fetch + git merge | |
git push <remote-name> <branch-name> | |
git ls-files --> shows a list of tracked files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment