Last active
December 17, 2015 12:29
-
-
Save vpivo/5610366 to your computer and use it in GitHub Desktop.
Git Cheat Sheet
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 config --global user.name "Your Name" | |
Sets the global username. | |
git config --global user.email [email protected] | |
Sets the global email. | |
git config --global alias.co checkout | |
Creates an alias for checkout, now I just need to type co. | |
git config --global core.editor "subl -w" | |
Sets Sublime as my commit message editor. | |
git init | |
Creates the initial local repo. | |
git checkout -f | |
Force overwrites the currents changes. | |
git checkout -b BRANCH NAME | |
creates a branch *and* checks it out. | |
git branch | |
Shows the current branch. | |
git add . | |
Adds all files to commit. | |
git mv file.name newfile.name | |
Changes the name of a file. | |
git commit -a -m "Message here!" | |
a- only commits changes to existing files. | |
To Merge From a Branch | |
git pull (while on working branch) | |
git checkout master | |
git merge branch name | |
git branch -d branch name To delete | |
git add . | |
git commit -m "message" | |
git push | |
To Delete Branch Changes | |
git checkout -b branch name | |
... do bad stuff... | |
git add . | |
git commit -m 'message here' | |
git checkout master | |
git branch -D topic-branch | |
bundle install --without GROUP NAME | |
Updates the Gemfile.lock without locally installing the gem. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment