Re: how to omit rename file when commit
On Monday 2009 January 19 03:35:41 you wrote:
Show 8 quoted lines
>For example:
>there are 2 file. a.c and e.c
>I modify e.c.
>and git mv a.c b.c
>
>git update-index e.c
>
>I just want to commit e.c and don't commit rename(a.c -> b.c)
Here, it looks like all you need to do is follow the instructions given by git
status--use "git reset HEAD" on each file you want unstaged:
$ rm -rf test && mkdir test
$ cd test
/home/bss/test
$ git init
Initialized empty Git repository in /home/bss/test/.git/
$ echo b > a.c; echo d > e.c
$ git add a.c b.c e.c
$ git commit -m 'Setup'
Created initial commit fc9d26e: Setup
2 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 a.c
create mode 100644 e.c
$ git mv a.c b.c
$ echo e > e.c
$ git add e.c
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: a.c -> b.c
# modified: e.c
#
$ git reset HEAD -- a.c b.c
a.c: locally modified
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: e.c
#
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
#
# deleted: a.c
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# b.c
$ git commit -m 'e.c: Fix typo'
Created commit c23b226: e.c: Fix typo
1 files changed, 1 insertions(+), 1 deletions(-)
$ git status
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
#
# deleted: a.c
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# b.c
no changes added to commit (use "git add" and/or "git commit -a")
HTH.
--
Boyd Stephen Smith Jr. ,= ,-_-. =.
bss@iguanasuicide.net ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-'
http://iguanasuicide.net/ \_/