去除最後一筆commit
$git log
commit 1a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: A_Chang
Date: Fri Mar 30 23:59:59 2012 +0800
audit
commit 2a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: B_Chang
Date: Fri Mar 29 23:59:59 2012 +0800
audit
$git reset --soft HEAD^
$git log
commit 2a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: B_Chang
Date: Fri Mar 29 23:59:59 2012 +0800
audit
去除git add的動作
【方法一】
$git log
commit 1a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: A_Chang
Date: Fri Mar 30 23:59:59 2012 +0800
audit
commit 2a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: B_Chang
Date: Fri Mar 29 23:59:59 2012 +0800
audit
$git reset 1a66bbbd5628 --mixed
$git log
commit 2a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: B_Chang
Date: Fri Mar 29 23:59:59 2012 +0800
audit
$git status
# Untracked files:
# (use "git add <file>..." to include in what will be commited)
#
# packages/apps/Music/Android.mk
【方法二】
$git status
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: packages/apps/Music/Android.mk
$git reset packages/apps/Music/Android.mk
$git status
# Untracked files:
# (use "git add <file>..." to include in what will be commited)
#
# packages/apps/Music/Android.mk
去除檔案的修改
【方法一】
$git log
commit 1a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: A_Chang
Date: Fri Mar 30 23:59:59 2012 +0800
audit
commit 2a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: B_Chang
Date: Fri Mar 29 23:59:59 2012 +0800
audit
$git reset 1a66bbbd5628 --hard
$git log
commit 2a66bbbd5628c754b8628c754b8539b94d51684beb0e88407
Author: B_Chang
Date: Fri Mar 29 23:59:59 2012 +0800
audit
$git status
# Untracked files:
# (use "git add <file>..." to include in what will be commited)
#
【方法二】
$git status
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: packages/apps/Music/Android.mk
$git checkout packages/apps/Music/Android.mk
$git status
# Untracked files:
# (use "git add <file>..." to include in what will be commited)
#
沒有留言:
張貼留言