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

How do I get the correct modification status after running git diff?

From
Jjateeq <jawad_atiq@hotmail.com>
Date
Mar 4, 2010, 15:40 UTC
Message-ID
<27782430.post@talk.nabble.com>
Hello,

I have added a new file to a working repository, and would like to run a diff between the last commit and whatever is int he working tree, along with an identification of what kind of a modification it was. Currently, I am adding all files to the index with the -N option, and then running a git diff --name-status. This works well for existing files that have been modified or deleted, but fails if a file is rename or is added. Does anyone know of the right way to do this? The commands I am using to add and diff newly added files are as follows in the sequence shown.

Commands: echo "this is a new file" > file1.xml git add -N . git diff --name-status

The output is : M file1.xml

I want the status to show A for the newly added file (and R for renamed files but I don't know if that's possible).

Thank You, Jawad.

-- 
View this message in context: http://old.nabble.com/How-do-I-get-the-correct-modification-status-after-running-git-diff--tp27782430p27782430.html
Sent from the git mailing list archive at Nabble.com.
Next: jateeq
Message 1 of 4 in “How do I get the correct modification status after running git diff?”
  1. jateeqMar 4, 2010
  2. jateeqMar 4, 2010
  3. Michael J GruberMar 4, 2010
  4. Andreas SchwabMar 4, 2010

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.