git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to omit rename file when commit

From
Boyd Stephen Smith Jr. <bss@iguanasuicide.net>
Date
Jan 19, 2009, 17:41 UTC
Message-ID
<200901191141.07440.bss@iguanasuicide.net>
In-Reply-To
<1976ea660901190135k71087673p85e995878e539a8f@mail.gmail.com>
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/                      \_/     
Previous: Jakub Narebski
Message 5 of 5 in “how to omit rename file when commit”
  1. Frank LiJan 19, 2009
  2. Junio C HamanoJan 19, 2009
  3. Frank LiJan 19, 2009
  4. Jakub NarebskiJan 19, 2009
  5. Boyd Stephen Smith Jr.Jan 19, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.