Last active
September 27, 2015 19:27
-
-
Save jestan/1319504 to your computer and use it in GitHub Desktop.
My Git Commands
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
#### Create a feature branch | |
git checkout -b <branch-name> | |
#### Create a remote branch for the feature branch | |
git push origin refs/heads/<branch-name> | |
#### Delete a remote branch | |
git push origin :refs/heads/<branch-name> | |
#### Purne obsolute remote branches | |
git remote prune origin --dry-run | |
git remote prune origin | |
#### Delete a local branch | |
git branch -d <branch-name> | |
git branch -D <branch-name> | |
#### create a tag | |
git tag -a <tag-name> -m <message> | |
git push origin refs/tags/<tag-name> | |
#### Clone only master and specified branch | |
git clone --branch master <repo url> | |
git fetch origin <branch name> | |
git pull origin <branch name> | |
git checkout <branch name> | |
All about git paths http://www.siteground.com/tutorials/git/directory.htm | |
Cheat Sheet http://cheat.errtheblog.com/s/git | |
#### Stash the local changes | |
git stash | |
#### Apply the stash | |
git stash pop | |
#### Clear the stash | |
git stash clear | |
#### Restore a deleted file | |
git checkout <file path> | |
#### Restore a deleted directory | |
git checkout FETCH_HEAD -- <directory path> | |
#### Cleanup Remote Dead Branches | |
git remote prune origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment