public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Thomas Rast <trast@inf•ethz.ch>
To: Raza Ali <rali@ebi•ac.uk>
Cc: <git@vger•kernel.org>
Subject: Re: re-ignoring a force added file
Date: Wed, 14 Aug 2013 11:22:42 +0200	[thread overview]
Message-ID: <87ioz8hbj1.fsf@linux-k42r.v.cablecom.net> (raw)
In-Reply-To: <520A7B79.4080306@ebi.ac.uk> (Raza Ali's message of "Tue, 13 Aug 2013 19:31:21 +0100")

Raza Ali <rali@ebi•ac.uk> writes:

> I have force added a file we usually like to ignore (but keep in the
> repository). That was a change a while ago, and cannot be undone
> without serious pain. I would like to re-ignore the file though, as we
> dont want to track changes to it. Some of the options I came across
> are not useful for me. For example
>
> git rm --cached FILE // removes the file from the remote repository if
> I push, not desirable
> git update-index --assume-unchanged //Will ignore changes to the file
> locally, but someone else clones and the file is tracked for them.
>
> What we would like is to go back to the old state of affairs: the file
> was in the working directory when someone cloned from the remote
> repository, but changes to the file werent tracked or committed.

I highly doubt that this description is accurate:

Either the file was actually in the repository (more specifically, in
the commit that git-clone chose to be checked out).  In this case, it
appears in the worktree after cloning.  But its presence in the HEAD
commit of the resulting repo also means that it is tracked.

Or it was not in the repository.  In which case it will not appear in a
new clone.  And there is no third option here.

So your "old state" in fact did not exist.  And it unfortunately is also
not attainable in more roundabout ways: any given file can only be
either tracked or ignored (or untracked-but-not-ignored, but that's
beside the point).  You cannot use ignore rules to ignore files that are
tracked.

Please check https://gist.github.com/canton7/1423106 for a list of other
ways to achieve what you are trying to do (link from the corresponding
bot quote on #git).  But do note that --assume-unchanged is a rather
more dangerous beast than you may think, and I cannot recommend actually
using it.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

      reply	other threads:[~2013-08-14  9:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 18:31 re-ignoring a force added file Raza Ali
2013-08-14  9:22 ` Thomas Rast [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ioz8hbj1.fsf@linux-k42r.v.cablecom.net \
    --to=trast@inf$(echo .)ethz.ch \
    --cc=git@vger$(echo .)kernel.org \
    --cc=rali@ebi$(echo .)ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox