Last active
February 20, 2017 10:36
-
-
Save Rud5G/4525931 to your computer and use it in GitHub Desktop.
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
## config | |
# user | |
git config --global user.name "Rudger " | |
git config --global user.email "" | |
# color | |
git config --global color.ui true | |
# vim editor | |
git config --global core.editor vim | |
# --no-ff is default merge behaviour | |
git config --global merge.ff false | |
# push matching is default push behaviour | |
git config --global push.default current | |
# nothing : Do not push anything | |
# matching : Push all matching branches | |
# tracking : Push the current branch to whatever it is tracking | |
# current : Push the current branch | |
## diff | |
# show staged changes (not commited yet). | |
git diff --staged | |
# remove staged file(s) (local files do not get removed). | |
git rm --cached [file] | |
# view log including patches | |
git log -p | |
git log --graph --decorate --pretty=oneline --abbrev-commit (--all) | |
## branching | |
# merge a specific file from a branch | |
git checkout <branchname> -- <filename> | |
# track & create local branch from remote branch | |
git checkout --track -b <branchname> origin/<branchname> | |
# track local branch to remote branch | |
git branch --set-upstream <branchname> origin/<branchname> | |
# update fork | |
git remote add upstream git://github.com/user/project.git | |
# Fetches any new changes from the original repo | |
git fetch upstream | |
# Merges any changes fetched into your working files | |
git merge upstream/master | |
# fetch and merge is pull (use fetch+merge) | |
git pull upstream/master | |
git merge upstream/master | |
# Merges any changes fetched into your working files | |
## submodule | |
# submodule recursive update | |
git submodule foreach --recursive git submodule update --init | |
## misc | |
# recursive remove svn | |
rm -rf `find . -type d -name .svn` | |
# auto create modman | |
for line in `find * -type f`; do echo "${line} ${line}" >> modman ; done | |
# http://unix.stackexchange.com/a/7455 | |
screen && tig | |
# links | |
# http://learn.github.com/p/normal.html | |
# http://stackoverflow.com/a/5555118 | |
# http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/ | |
# http://vimeo.com/16018419 | |
# http://nvie.com/posts/a-successful-git-branching-model/ | |
# https://github.com/nvie/gitflow | |
##_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment