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

Re: .gitignore does not ignore Makefile

From
Kevin Daudt <me@ikke.info>
Date
Sep 22, 2016, 15:44 UTC
Message-ID
<20160922154421.GA6641@ikke.info>
In-Reply-To
<CAOZdJXWpcSZ+jAoV8HttkaB7Fh=wzWDTCsHy8W-S9xOOBodVFw@mail.gmail.com>
On Thu, Sep 22, 2016 at 09:19:22AM -0500, Timur Tabi wrote:
Show 15 quoted lines
> I have the following .gitignore file in patch arm/arm64/boot/dts:
> 
> *.dtb
> qcom
> qcom.orig
> 
> When I do a git status, I see this:
> 
>     modified:   .gitignore
>     modified:   qcom/Makefile
> 
> All of the other files in arm/arm64/boot/dts/qcom are being ignored,
> as request.  However, the file "Makefile" is not being ignored.  Why?
> What's so special about "Makefile" that git refuses to ignore it?
> 

There is nothing special about the Makefile, except that it's tracked. Git never ignores tracked files (almost a paradox).

You can untrack the file by doing git rm --cached <file>, which new commits won't have this file.

If your goal is to ignore local changes to a tracked file, then the advise is to reconsider your plan.

Often people advise tricks like `git update-index --assume-unchanges <file>`, but this does not work as expected. It's merely a promise to git that this file does not change (and hence, git will not check if this file has changed when doing git status), but command that try to change this file will abort saying that the file has changed.

Hope this helps,
Kevin.
Previous: Timur TabiNext: Junio C Hamano
Message 2 of 6 in “.gitignore does not ignore Makefile”
  1. Timur TabiSep 22, 2016
  2. Kevin DaudtSep 22, 2016
  3. Junio C HamanoSep 22, 2016
  4. Timur TabiSep 22, 2016
  5. Junio C HamanoSep 22, 2016
  6. Jakub NarębskiSep 23, 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.