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

git-mv ignores gitignore file

From
ZLZheng Lv <lv.zheng.2015@gmail.com>
Date
Feb 16, 2016, 08:35 UTC
Message-ID
<56C2DF44.10309@gmail.com>
gitignore(5) manual says that
> A gitignore file specifies intentionally untracked files that Git 
> should ignore. Files already tracked by Git are not affected ...
> The purpose of gitignore files is to ensure that certain files not 
> tracked by Git remain untracked.
which means that the following operations are totally correct.

$ echo "b" >> .gitignore $ echo "Something" > a $ git add a $ git mv a b

Equivalantly,

$ echo "b" >> .gitignore $ echo "Something" > b $ git add --force b

That is, doing something --force when --force it is not specified.

However, this may not be the intented behavior. The user might not want to equivalantly add a `new' file b to the index when b should be gitignored. Such operations are possibly oversight of users.

The ideal behavior, issue a warning when git-mv target collides with gitignore.

Thanks.
Message 1 of 1 in “git-mv ignores gitignore file”
  1. Zheng LvFeb 16, 2016

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.