2014-09-28 更新
SOME COMMOND
git diff 40ef25ddfcee..HEAD >~/m.diff ./test/test.m
git diff HEAD^..HEAD
git diff ..v3.4.0 hw8264/xx.m
//edit the last commit
git commit --amend -m "New commit message"
git reset --soft HEAD^
//name a anonymous state
git checkout -b dynamicimage
//
# to create a new branch and switch to it in one step
$ git checkout -b <branch-name>
Ricard123
//checkout a tag as branch
git checkout -b appstore v3.0.0_1
$ git merge hotfix 合并某个branch
#checkou a commit as branch
git checkout -b newbranchname 0d1d7fc32
//push a branch
git push -u origin mybranch
#diff file has added
$ git diff --cached
git push origin <local-branch-name>:<remote-branch-name>
Substitute for <local-branch-name> and <remote-branch-name>. They may be same or different, as you wish.
//revert an published commit
git revert dd61ab32
http://stackoverflow.com/questions/4114095/revert-to-a-previous-git-commit
//check an old commit as a commit
git co -b nt2 128a1a108e7affcc00bc85b5a333a1f35aa46f7f
//remove local branch
git branch -D the_local_branch
//To delte a remote branch (if you know what you are doing!)
git push origin :the_remote_branch
//push a branch
git push origin newbranch
//rename a local Git branch?
git branch -m <oldname> <newname>
//If you want to rename the current branch, you can simply do:
git branch -m <newname>
//add tag
git tag -a v3.4.0 -m "app store 3.4.0."
#rename a tag
git tag new old
//show all tags
git tag
//git delete a tag
git tag -d tag1
//show tag info
git show v1.0.0
git push origin :the_remote_branch
//update local project
git pull
//mac show hidden files
defaults write com.apple.Finder AppleShowAllFiles YES
defaults write com.apple.finder AppleShowAllFiles -bool NO
//start playing automatically when open
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1
//save stash with name
$ git stash save "show reply text on my reply view"
Saved working directory and index state On master: show reply text on my reply view
HEAD is now at ef612d6 fix bug: notify center will blank line when there is no reply txt
YangtekiMacBook-Pro:huwai_ios_v3 yangeric$ git stash list
stash@{0}: On master: show reply text on my reply view
stash@{1}: WIP on (no branch): e6385d7 change notifycenter ui
git stash drop stash@{0}
//show the a list of special commit
git diff-tree --no-commit-id --name-only -r 73f6f7cd898241c2d661c76b253c32d11be3b8a5
#rename a remote
git remote rename origin destination
# Change remote name from 'origin' to 'destination'
https://help.github.com/articles/syncing-a-fork
//undo merge
git reset --hard HEAD^
git reset --hard HEAD~5
# get all git command history
git reflog --date=local
//get branch diff
git diff master..branch
git diff --name-status master..branch
//show all conflicted file after merge branch
git diff --name-only --diff-filter=U
//show diff which was "git add"
git diff --cached
//rename or transfer a repository
//https://github.com/blog/1508-repository-redirects-are-here
git remote set-url origin new_url
//Fetching a remote
https://help.github.com/articles/fetching-a-remote
git pull -u originmaster master
#chmod recursive
chmod -R 777 blog
//down submodule recursive
git submodule update --init --recursive
//list special tag list
$ git tag -l v1.4.2.*
//show tag info
$ git show v4.0.0
//show commit info
$ git show 1894ce8b333e9ed8da42900a253e42d6e59edabb
整页翻页 ctrl-f ctrl-b
f就是forword b就是backward
翻半页
ctrl-d ctlr-u
d=down u=up
滚一行
ctrl-e ctrl-y
gong
cd ~/Library/Developer/Xcode/DerivedData
//copy directory
cp -vr .git/ ../MultiTablesView-master/.git
1、前景色填充ALT+DEL或ALT+BackSpace。
2、背景色填充CTRL+DEL或CTRL+BackSpace。
3、按D键可以以恢复默认的前景色(黑)、背景色(白)。
4、按X键可以切换前景色、背景色。