git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Making Git untrack few folders
       [not found] <AANLkTi=vjueuP66BAMsRDww=J3Nq3Q4BooKF+85khcBn@mail.gmail.com>
@ 2010-09-12 10:22 ` Parag Kalra
  2010-09-12 10:37   ` Ramkumar Ramachandra
  0 siblings, 1 reply; 3+ messages in thread
From: Parag Kalra @ 2010-09-12 10:22 UTC (permalink / raw)
  To: git

Hi All,

I have couple of interconnected questions:

1. Is there a way I can make Git not track a particular folder in my
working code base directory. For example, I have a tmp folder in my
local code base and I don't want Git to track whats going on inside
that directory.

2. Accidently I have added this folder, committed and pushed it to
origin master. Is there a way I can remove this tmp folder from git
revision history and at the same time keeping it intact in my local
code base directory.

Cheers,
Parag

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Making Git untrack few folders
  2010-09-12 10:22 ` Making Git untrack few folders Parag Kalra
@ 2010-09-12 10:37   ` Ramkumar Ramachandra
  2010-09-12 20:00     ` Parag Kalra
  0 siblings, 1 reply; 3+ messages in thread
From: Ramkumar Ramachandra @ 2010-09-12 10:37 UTC (permalink / raw)
  To: Parag Kalra; +Cc: git

Hi Parag,

Parag Kalra writes:
> 1. Is there a way I can make Git not track a particular folder in my
> working code base directory. For example, I have a tmp folder in my
> local code base and I don't want Git to track whats going on inside
> that directory.

Yes. See gitignore (5).

> 2. Accidently I have added this folder, committed and pushed it to
> origin master. Is there a way I can remove this tmp folder from git
> revision history and at the same time keeping it intact in my local
> code base directory.

Yes. Simply `rm --cached` the folder, and amemd your previous commit
using `commit --amend`, and perform a non-ff push using the `+`
syntax. For example, to perform a non-ff push to remote branch `foo`
whose local name is `foo`, invoke `push +foo:foo`. Note that other
users who have already pulled the bad commit will have to forget about
it explicitly too.

If the folder tracking information is a few revision deep, consider
using `rebase -i` to manually overwrite those commits to exclude that
folder. If the folder was too many revisions earlier, use a
`filter-branch` index filter to make Git completely forget that
folder.

-- Ram

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Making Git untrack few folders
  2010-09-12 10:37   ` Ramkumar Ramachandra
@ 2010-09-12 20:00     ` Parag Kalra
  0 siblings, 0 replies; 3+ messages in thread
From: Parag Kalra @ 2010-09-12 20:00 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: git

Thanks Ram.

git rm --cached was precisely what I was looking for.

Also .gitignore file worked without any issues.

Cheers,
Parag




On Sun, Sep 12, 2010 at 3:37 AM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Hi Parag,
>
> Parag Kalra writes:
>> 1. Is there a way I can make Git not track a particular folder in my
>> working code base directory. For example, I have a tmp folder in my
>> local code base and I don't want Git to track whats going on inside
>> that directory.
>
> Yes. See gitignore (5).
>
>> 2. Accidently I have added this folder, committed and pushed it to
>> origin master. Is there a way I can remove this tmp folder from git
>> revision history and at the same time keeping it intact in my local
>> code base directory.
>
> Yes. Simply `rm --cached` the folder, and amemd your previous commit
> using `commit --amend`, and perform a non-ff push using the `+`
> syntax. For example, to perform a non-ff push to remote branch `foo`
> whose local name is `foo`, invoke `push +foo:foo`. Note that other
> users who have already pulled the bad commit will have to forget about
> it explicitly too.
>
> If the folder tracking information is a few revision deep, consider
> using `rebase -i` to manually overwrite those commits to exclude that
> folder. If the folder was too many revisions earlier, use a
> `filter-branch` index filter to make Git completely forget that
> folder.
>
> -- Ram
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-12 20:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <AANLkTi=vjueuP66BAMsRDww=J3Nq3Q4BooKF+85khcBn@mail.gmail.com>
2010-09-12 10:22 ` Making Git untrack few folders Parag Kalra
2010-09-12 10:37   ` Ramkumar Ramachandra
2010-09-12 20:00     ` Parag Kalra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).