Last active
October 4, 2016 09:26
-
-
Save chreke/472e1a3abb8cdeead492e5c9cb2d813d to your computer and use it in GitHub Desktop.
Git command cheat sheet
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
# GENERAL | |
# ======= | |
# View status | |
git status | |
# ADDING CHANGES | |
# ============== | |
# The "staging area" is git terminology for what will end up in your next commit | |
# Add changes to staging area. Use -p to add patches interactively. | |
git add [files] | |
# Remove changes from staging area. Use -p to remove patches interactively. | |
git reset [files] | |
# List uncommitted changes that haven't been staged | |
git diff | |
# List contents of staging area | |
git diff --cached | |
# COMMITTING | |
# ========== | |
# Commit contents of staging area. Use --verbose to see a summary of changes | |
# when you edit the commit message. Use -m to specify a commit message inline. | |
git commit | |
# Add more changes to your latest commit. WARNING! Changes history! | |
git commit --amend | |
# PUSHING / PULLING CHANGES | |
# ========================= | |
# Push changes | |
git push | |
# This overwrites the remote branch with the contents of your local branch. | |
# WARNING! This is as dangerous as it sounds. Use with extreme prejudice. | |
git push -f | |
# Pull changes. A merge commit will be created to integrate changes into | |
# your local branch. | |
git pull | |
# Rebase your local commits on the remote changes. This changes your local | |
# history only, so it's safe to use. | |
git pull --rebase | |
# HISTORY | |
# ======= | |
# View commits. Use -p to view actual contents of commit. Use --name-only to | |
# only list names of changed files. | |
git log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment