Created
September 25, 2015 00:41
-
-
Save michaelbishoff/947ae61a62d7817ebacd to your computer and use it in GitHub Desktop.
Useful git commands
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 add <file> # Adds a file to be staged | |
git commit -m “Message” # Writes a message with the staged file | |
git push -u origin master | |
git diff HEAD # Views the diff of your new changes and the previous commit | |
git diff —staged # Diff of changes that are now staged and HEAD | |
git reset <file> # Opposite of git add. Upstages the file. Does Not remove them. File is still there. | |
git checkout — <file> # Undo. Resets file back to what it was in the last commit | |
git rm <file> # Removes the file from the repo | |
git branch # View all branches | |
git branch <new_branch> # Create a new branch. This does Not change which branch you’re on. NOTE: Now when you push you need to do: git push -u origin <new_branch> | |
git branch -d <branch> # Deletes a branch | |
git branch -m <new_branch_name> # Renames the current branch. | |
git checkout <branch> # Changes to the specified branch. | |
git merge <other_branch> # Merges the other branch with this one |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment