# how to omit rename file when commit

5 messages from 2009-01-19 to 2009-01-19. Participants: Frank Li, Junio C Hamano, Jakub Narebski, Boyd Stephen Smith Jr..
Thread: https://gitlist.dev/t/17249

## Frank Li, 2009-01-19 09:13

Subject: how to omit rename file when commit
Message-ID: <1976ea660901190113l5407f108lff8f37d9a8331f58@mail.gmail.com>
URL: https://gitlist.dev/e/1976ea660901190113l5407f108lff8f37d9a8331f58%40mail.gmail.com

```
For example there are a file a.c at git repository.
use
git mv a.c b.c

git status:
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       renamed:    a.c -> b.c

If we don't want to stage this change at this commit,  what can I do?

```

## Junio C Hamano, 2009-01-19 09:16

Subject: Re: how to omit rename file when commit
Message-ID: <7v63kbr6zc.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v63kbr6zc.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <1976ea660901190113l5407f108lff8f37d9a8331f58@mail.gmail.com>

```
"Frank Li" <lznuaa@gmail.com> writes:

> For example there are a file a.c at git repository.
> use
> git mv a.c b.c
>
> git status:
> # On branch master
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       renamed:    a.c -> b.c
>
> If we don't want to stage this change at this commit,  what can I do?

I may be misunderstanding what you want to do, but wouldn't "git mv b.c
a.c" undo whatever you did?

```

## Frank Li, 2009-01-19 09:35

Subject: Re: how to omit rename file when commit
Message-ID: <1976ea660901190135k71087673p85e995878e539a8f@mail.gmail.com>
URL: https://gitlist.dev/e/1976ea660901190135k71087673p85e995878e539a8f%40mail.gmail.com
In-Reply-To: <7v63kbr6zc.fsf@gitster.siamese.dyndns.org>

```
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)

I am debuging a tortoisegit.  at commit dialog, there will be show all
changed as
[x] rename (a.c => b.c)
[x] modify (e.c)
button [OK]

assume user uncheck rename
[]rename (a.c=>b.c)
[x]modify (e.c)

then click okay.

I don't know use which git command to handle this case.
if git mv b.c a.c, local working copy will be changed.


2009/1/19 Junio C Hamano <gitster@pobox.com>:
> "Frank Li" <lznuaa@gmail.com> writes:
>
>> For example there are a file a.c at git repository.
>> use
>> git mv a.c b.c
>>
>> git status:
>> # On branch master
>> # Changes to be committed:
>> #   (use "git reset HEAD <file>..." to unstage)
>> #
>> #       renamed:    a.c -> b.c
>>
>> If we don't want to stage this change at this commit,  what can I do?
>
> I may be misunderstanding what you want to do, but wouldn't "git mv b.c
> a.c" undo whatever you did?
>
>

```

## Jakub Narebski, 2009-01-19 11:01

Subject: Re: how to omit rename file when commit
Message-ID: <m3vdsby2y4.fsf@localhost.localdomain>
URL: https://gitlist.dev/e/m3vdsby2y4.fsf%40localhost.localdomain
In-Reply-To: <1976ea660901190135k71087673p85e995878e539a8f@mail.gmail.com>

```
"Frank Li" <lznuaa@gmail.com> writes:

> 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)

The simplest way (but I'm not sure if it is what you want) would be

  $ git commit e.c

-- 
Jakub Narebski
Poland
ShadeHawk on #git

```

## Boyd Stephen Smith Jr., 2009-01-19 17:41

Subject: Re: how to omit rename file when commit
Message-ID: <200901191141.07440.bss@iguanasuicide.net>
URL: https://gitlist.dev/e/200901191141.07440.bss%40iguanasuicide.net
In-Reply-To: <1976ea660901190135k71087673p85e995878e539a8f@mail.gmail.com>

```
On Monday 2009 January 19 03:35:41 you wrote:
>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/                      \_/     

```
