Last active
December 22, 2015 10:28
-
-
Save hugocore/6458489 to your computer and use it in GitHub Desktop.
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 commands | |
* Init a git/github repo, avoiding the user/password request issue | |
$ git init | |
$ git add . | |
$ git commit -m "Initial commit" | |
# Create Github repo | |
$ git remote add origin [email protected]:<username>/<repo_name>.git | |
$ git push -u origin master | |
* Push a local branch to remote | |
$ git push origin <new-branch> | |
* Diff between *HEAD*, *staged* and *working tree* (http://stackoverflow.com/a/1587952/1700053) | |
$ git diff --chached #diff between HEAD and staged | |
$ git diff HEAD #diff between HEAD and working tree | |
$ git dff #diff between staged and working tree | |
* Pull in upstream changes (if the original repo you forked your project from gets updated): | |
$ git remote add upstream git://github.com/<user>/<repo_name>.git | |
$ git fetch upstream | |
$ git merge upstream/master | |
### Git configuration | |
$ git config --global color.ui true | |
$ git config --global user.name "Your Name" | |
$ git config --global user.email [email protected] | |
$ git config --global alias.co checkout | |
$ git config --global core.editor "subl -w" | |
$ git config --global alias.st "status -sb" | |
$ git config --global alias.ammend "commit --amend -C HEAD" | |
$ git config --global alias.undo "reset --soft HEAD^" | |
$ git config --global core.filemode false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment