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

Re: git not tracking changes

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jan 2, 2007, 05:59 UTC
Message-ID
<20070102055937.GD27690@spearce.org>
In-Reply-To
<b5a19cd20701012152n4f496198h93cab1b9b85a9a45@mail.gmail.com>
Deepak Barua <dbbarua@gmail.com> wrote:
Show 5 quoted lines
> Hi,
>    When i do a git add of a config.h file then make some changes and
> then do git commit it does not reflect the changes..
> eg
> dep@zion:~/programs/elinks/elinks-0.11-20061220$ git add config.h

Here you told Git to take the current contents of config.h and stage it into the index. That content will be in the next commit.

> dep@zion:~/programs/elinks/elinks-0.11-20061220$ vi config.h

Then you modify it. Git doesn't know about those changes to config.h, nor does it care at this point.

> dep@zion:~/programs/elinks/elinks-0.11-20061220$ git commit
> nothing to commit

This is occuring because the content staged in the index does not differ from the content in HEAD (the last commit on this branch). You need to run `git add config.h` again now that you have modified it to restage the modified file.

Basically I'm assuming that when you ran `git add config.h` the first time the content must have matched HEAD, which meant you didn't actually stage anything.

-- 
Shawn.
Previous: Deepak BaruaNext: Deepak Barua
Message 2 of 3 in “git not tracking changes”
  1. Deepak BaruaJan 2, 2007
  2. Shawn O. PearceJan 2, 2007
  3. Deepak BaruaJan 2, 2007

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.