选项: --mixed 只撤销掉index中的commit,却保留那个commit对应的内容 --hard index和working dir全撤销,也就是commit消失,并且其内容也消失 --soft index和working dir都不动,只"require them to be in a good order" ( 这是man git-reset中的话,什么意思?) 。这会让该commit修改的文件变 成"dded but not yet committed"的状态。
如果不加这3个参数之一,那git-reset默认就是--mixed方式。
/*{{{*/ [FYI] git-reset --hard之后又想恢复 在git中,除非你运行了git-gc --prune,否则历史是永远不会被擦除的,你可以随意恢复到任何历史状态。 下面就是 一个恢复被git-reset --hard擦除了的commit的例子: //reset最近的commit $ git-reset --hard HEAD^ HEAD is now at bc45eb8 Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
//查看reflog $ git-reflog bc45eb8... HEAD@{0}: HEAD^: updating HEAD a7dc750... HEAD@{1}: commit: [PCI] code cleanup : remove dead pci_remove_device_safe() bc45eb8... HEAD@{2}: checkout: moving from jike to bc45eb8950b8c14487385cfd2bda1613ca8d9703
//reset回去 $ git-reset --hard HEAD@{1} //注意,HEAD@{1}就是我们要恢复的那个状态 HEAD is now at a7dc750 [PCI] code cleanup : remove dead pci_remove_device_safe()
参数: list //列出所有stash了的项目,注意会显示stash的ID show [-p] [stash@{}] //查看某个stash,-p会显示补丁。 如果不指定id,则show最近stash的那个 apply [stash@{}] //恢复某个stash。 如果不指定id,则apply最近stash的那个 save //stash当前的未提交的改动 clear //销毁所有stash了的未提交改动
不加参数的话,默认行为就是save。
例如: $ git-stash list stash@{0}: WIP on test: 42bb109... a commit to fix. --fixed in git-rebase, "edit" stash@{1}: WIP on test2: 10253e6... Merge branch 'test' into test2 stash@{2}: WIP on test2: 10253e6... Merge branch 'test' into test2
注意'test'和'test2'都是branch。 $ git-stash show -p stash@{2}
$ make ../git_bisect_output/ 编译: $ make O=../git_bisect_output/ menuconfig $ make O=../git_bisect_output/ V=1 -j4 $ sudo make O=../git_bisect_output/ V=1 modules_install install 注意,最好在menuconfig时,给local version加上一个string,例如take1、take2等。 启动新编译的kernel,如果还有BUG: $ git-bisect bad 如果没有BUG了: $ git-bisect good
//jike分支的HEAD位于一个local commit处 [arc@localhost linux-2.6]$ git log -1 1 commit f8a561aa5fef94becc76a5509a369b742f925058 2 Author: Jike Song <> 3 Date: Mon Sep 8 22:26:14 2008 +0800 4 5 PCI: utilize calculated results when detecting MSI features 6 7 in function msi_capability_init, we can make use of the calculated 8 results instead of calling is_mask_bit_support and is_64bit_address 9 twice, in spite of the fact that they are macros. 10 11 Signed-off-by: Jike Song <>
//已经rebase了master分支,现在jike分支除了作为HEAD的local commit之外,和master一样了 //注意,这里jike分支是rc5-362,此时master分支是rc5-361,正好多一个commit,就是我本地的这个 [arc@localhost linux-2.6]$ git-describe v2.6.27-rc5-362-gedaa7ca [arc@localhost linux-2.6]$ git log -1 1 commit edaa7ca47705cc6ca695e267f88f91dbe958da44 2 Author: Jike Song <> 3 Date: Mon Sep 8 22:26:14 2008 +0800 4 5 PCI: utilize calculated results when detecting MSI features 6 7 in function msi_capability_init, we can make use of the calculated 8 results instead of calling is_mask_bit_support and is_64bit_address 9 twice, in spite of the fact that they are macros. 10 11 Signed-off-by: Jike Song <> /*}}}*/
//一种配置。 已验证此~/.msmtprc文件在公司内网可用,但Linux上不行 defaults tls on account gmail host smtp.gmail.com from auth on user password [mypasswd] port 587 account default:gmail
//另一种配置。 在Linux上,公司里和家里都能用 //注意/etc/pki/tls/certs/ca-bundle.crt在我的FC8上是openssl包中的 defaults tls on tls_trust_file /etc/pki/tls/certs/ca-bundle.crt logfile ~/.msmtp.log # My email service account gmail host smtp.gmail.com port 587 from auth on user password # Set a default account account default : gmail