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

(beginner) git rm

From
ZZabre <427@free.fr>
Date
Jan 28, 2009, 10:11 UTC
Message-ID
<1233137498146-2231416.post@n2.nabble.com>
Hi,

I am learning git and there is something I don't get : why a file deleted in a branch gets also deleted in my master? (For the moment I'm only working locally, no remote repository)

I have a master branch containing 4 text files called a.txt , b.txt , c.txt , d.txt . (in HEAD)

I create a new branch from there (masters HEAD) and go to this new branch. $ git branch new $ git checkout new

I delete one file in the new branch $ git rm d.txt $ ls a.txt b.txt c.txt

Then I go back to the master branch and list the files there $ git checkout master $ls a.txt b.txt c.txt

I have not modified the master branch, why is d.txt deleted there also?

There must be something I did not understand in git behaviour (something to do with the index?) Thank you for your help.

-- 
View this message in context: http://n2.nabble.com/%28beginner%29-git-rm-tp2231416p2231416.html
Sent from the git mailing list archive at Nabble.com.
Next: Peter Krefting
Message 1 of 16 in “(beginner) git rm”
  1. ZabreJan 28, 2009
  2. Peter KreftingJan 28, 2009
  3. ZabreJan 28, 2009
  4. Tomas CarneckyJan 28, 2009
  5. ZabreJan 28, 2009
  6. Tomas CarneckyJan 28, 2009
  7. Theodore TsoJan 28, 2009
  8. ZabreJan 28, 2009
  9. ZabreJan 28, 2009
  10. Björn SteinbrinkJan 28, 2009
  11. ZabreJan 28, 2009
  12. ZabreJan 28, 2009
  13. Junio C HamanoJan 28, 2009
  14. Björn SteinbrinkJan 28, 2009
  15. Junio C HamanoJan 28, 2009
  16. Björn SteinbrinkJan 29, 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.