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

Re: git bisect/checkout and changes to .gitignore

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Jun 22, 2012, 10:31 UTC
Message-ID
<4FE44983.30209@viscovery.net>
In-Reply-To
<CAPTjJmq4zv6dBR2Z-HfM7CJoxfprSdJEYYELuyBfahw2PkZ4Lw@mail.gmail.com>
Am 6/22/2012 9:51, schrieb Chris Angelico:
Show 16 quoted lines
> At my workplace we use git to manage all of our source code. Every now
> and then, we decide that some particular file oughtn't to be
> git-managed, and add it into .gitignore and remove it from the
> repository (for instance, configuration files that become
> per-developer).
> 
> Is there a way to checkout an old version of the repository (before
> the file was added to .gitignore), then return to the current state,
> without destroying these sorts of files? Currently, checking out the
> old version quietly "takes control" of the file, and then checking out
> a newer one deletes it.
> 
> I've read through the man pages for 'git checkout' and 'gitignore' and
> searched the one for 'git config' (it's a little large to read all
> of), without seeing an option to preserve files on checkout. Is there
> a way to do this, and if so, where can I find it?

Files mentioned in .gitignore are considered garbage. But your file is precious, hence, you should not list it in .gitignore.

Here is a thread that is worthwhile to read. I posted a patch
http://thread.gmane.org/gmane.comp.version-control.git/185724/focus=185733
but it was dismissed, see
http://thread.gmane.org/gmane.comp.version-control.git/185724/focus=185746
-- Hannes
Previous: Chris AngelicoNext: Chris Angelico
Message 2 of 4 in “git bisect/checkout and changes to .gitignore”
  1. Chris AngelicoJun 22, 2012
  2. Johannes SixtJun 22, 2012
  3. Chris AngelicoJun 22, 2012
  4. Junio C HamanoJun 22, 2012

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.