Created
May 18, 2015 14:29
-
-
Save RobbiNespu/b32a0fbe2b3131304878 to your computer and use it in GitHub Desktop.
Git command 101
This file contains hidden or 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 help # shows git commands | |
git init # creates git repository in current directory | |
git add -A # adds all files in current directory to repository | |
git commit -m "message" # commits changes with specific message | |
git push # pushes committed changes to remote repository on server | |
git status # checks current status of the local repository | |
git pull # pulls updates from remote repository | |
git fetch # fetches changes from remote repository | |
git fetch -p # fetches changes with "prune" option removes local copies of deleted "remote" branches | |
git checkout my_branch # switches to branch named "my_branch" | |
git checkout -b my_branch # creates local branch named "my_branch" | |
git branch --delete my_branch # removes local branch named "my_branch" | |
git push origin --delete # removes remote branch named "my_branch" | |
git branch # displays local branches | |
git branch -a # displays all branches (local and remote) | |
git merge my_branch # merges branch named "my_branch" into branch on which we are checked out | |
git stash # creates stash with currently saved changes on current branch | |
git stash list # displays list of stashes | |
git stash apply # applies stash with previously saved changes | |
git reset --hard # discards all uncommitted local changes | |
git reset <file> # removes <file> added to repository from current index ("about to be committed" area) | |
git revert commit_name # creates new commit, which undoes all changes introduced in commit named commit_name | |
git revert HEAD # reverts commit we just created with additional "revert commit" | |
git reset --hard HEAD^ # reverts last commit without additional "revert commit" | |
git rebase my_branch # pulls changes from "my_branch" to branch on which we are checked out without making commit | |
git log # displays log of the commits in repository | |
git remote -v # gets address of the remote repository |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment