git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to omit rename file when commit
@ 2009-01-19  9:13 Frank Li
  2009-01-19  9:16 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Li @ 2009-01-19  9:13 UTC (permalink / raw)
  To: git

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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to omit rename file when commit
  2009-01-19  9:13 how to omit rename file when commit Frank Li
@ 2009-01-19  9:16 ` Junio C Hamano
  2009-01-19  9:35   ` Frank Li
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2009-01-19  9:16 UTC (permalink / raw)
  To: Frank Li; +Cc: git

"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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to omit rename file when commit
  2009-01-19  9:16 ` Junio C Hamano
@ 2009-01-19  9:35   ` Frank Li
  2009-01-19 11:01     ` Jakub Narebski
  2009-01-19 17:41     ` Boyd Stephen Smith Jr.
  0 siblings, 2 replies; 5+ messages in thread
From: Frank Li @ 2009-01-19  9:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to omit rename file when commit
  2009-01-19  9:35   ` Frank Li
@ 2009-01-19 11:01     ` Jakub Narebski
  2009-01-19 17:41     ` Boyd Stephen Smith Jr.
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2009-01-19 11:01 UTC (permalink / raw)
  To: Frank Li; +Cc: Junio C Hamano, git

"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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to omit rename file when commit
  2009-01-19  9:35   ` Frank Li
  2009-01-19 11:01     ` Jakub Narebski
@ 2009-01-19 17:41     ` Boyd Stephen Smith Jr.
  1 sibling, 0 replies; 5+ messages in thread
From: Boyd Stephen Smith Jr. @ 2009-01-19 17:41 UTC (permalink / raw)
  To: Frank Li; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 2055 bytes --]

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/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-19 17:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-19  9:13 how to omit rename file when commit Frank Li
2009-01-19  9:16 ` Junio C Hamano
2009-01-19  9:35   ` Frank Li
2009-01-19 11:01     ` Jakub Narebski
2009-01-19 17:41     ` Boyd Stephen Smith Jr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).