[root@btg ext4]# git status

# On branch master
# Changed but not updated:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#        modified:   fs/ext4/acl.h
#
# Untracked files:
[root@btg ext4]# git commit -am "fuck"
[master 4786fcc] fuck
 1 files changed, 0 insertions(+), 3 deletions(-)
[root@btg ext4]# git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
[root@btg ext4]# git format-patch -s -1
0001-fuck.patch
[root@btg ext4]# git log|grep commit|head -n2|tail -n1|awk -F " " '{ print $2 }'|xargs git reset --hard 
HEAD is now at 275d3ba ext4: remove loop around bio_alloc()
[root@btg ext4]# git status
# On branch master
10-01 00:41
查看更多