Re: Making Git untrack few folders

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]