Created
February 26, 2013 19:14
-
-
Save cmaureir/5041182 to your computer and use it in GitHub Desktop.
How to Git (Brief)
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
## Commands | |
# Clone repository from GitHub | |
git clone [email protected]:username/repository | |
# Check repository status (modified files, commits, etc) | |
git status | |
# Update repository | |
git pull | |
# Commit single file | |
git add modified_file | |
git commit -m "commit message" | |
# Commit *all* modified files (Be careful!) | |
git commit -am "commit message for all files" | |
# See differences of a local file with a server file | |
git diff file | |
# Discard local changes on a file (this will override the local file content, with the server file content) | |
git checkout file | |
## Situations | |
# 1. Old repository, I don't know if there will be some change and I want to update it. | |
# See if there is some modified file | |
git status | |
# If there is no changes | |
git pulll | |
# If there are some changes, and I want to apply them | |
git add modified_file | |
git commit -m "message" | |
git pull | |
git push | |
# If there are some changes, and I want to discard them | |
git checkout modified_file | |
git pull |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment