{"thread":{"id":"25080","subject":"Making Git untrack few folders","startedAt":"2010-09-12T10:22:40Z","lastAt":"2010-09-12T20:00:17Z","messageCount":3,"participants":["Parag Kalra","Ramkumar Ramachandra"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"150531","messageId":"AANLkTiktMe190OVPrTXMtmfaLRLXeJBZ4vSZewJecQWe@mail.gmail.com","threadId":"25080","inReplyTo":"AANLkTi=vjueuP66BAMsRDww=J3Nq3Q4BooKF+85khcBn@mail.gmail.com","subject":"Making Git untrack few folders","fromName":"Parag Kalra","fromEmail":"paragkalra@gmail.com","sentAt":"2010-09-12T10:22:40Z","receivedAt":"2010-09-12T10:22:40Z","isPatch":false,"sender":{"key":"paragkalra@gmail.com","avatar":null},"body":"Hi All,\n\nI have couple of interconnected questions:\n\n1. Is there a way I can make Git not track a particular folder in my\nworking code base directory. For example, I have a tmp folder in my\nlocal code base and I don't want Git to track whats going on inside\nthat directory.\n\n2. Accidently I have added this folder, committed and pushed it to\norigin master. Is there a way I can remove this tmp folder from git\nrevision history and at the same time keeping it intact in my local\ncode base directory.\n\nCheers,\nParag\n"},{"id":"150532","messageId":"20100912103717.GA24576@kytes","threadId":"25080","inReplyTo":"AANLkTiktMe190OVPrTXMtmfaLRLXeJBZ4vSZewJecQWe@mail.gmail.com","subject":"Re: Making Git untrack few folders","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-09-12T10:37:20Z","receivedAt":"2010-09-12T10:37:20Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Parag,\n\nParag Kalra writes:\n> 1. Is there a way I can make Git not track a particular folder in my\n> working code base directory. For example, I have a tmp folder in my\n> local code base and I don't want Git to track whats going on inside\n> that directory.\n\nYes. See gitignore (5).\n\n> 2. Accidently I have added this folder, committed and pushed it to\n> origin master. Is there a way I can remove this tmp folder from git\n> revision history and at the same time keeping it intact in my local\n> code base directory.\n\nYes. Simply `rm --cached` the folder, and amemd your previous commit\nusing `commit --amend`, and perform a non-ff push using the `+`\nsyntax. For example, to perform a non-ff push to remote branch `foo`\nwhose local name is `foo`, invoke `push +foo:foo`. Note that other\nusers who have already pulled the bad commit will have to forget about\nit explicitly too.\n\nIf the folder tracking information is a few revision deep, consider\nusing `rebase -i` to manually overwrite those commits to exclude that\nfolder. If the folder was too many revisions earlier, use a\n`filter-branch` index filter to make Git completely forget that\nfolder.\n\n-- Ram\n"},{"id":"150550","messageId":"AANLkTi=5_u+Ei-3+9uUYcv5bkrpGCuibMiOW-_N6H8tb@mail.gmail.com","threadId":"25080","inReplyTo":"20100912103717.GA24576@kytes","subject":"Re: Making Git untrack few folders","fromName":"Parag Kalra","fromEmail":"paragkalra@gmail.com","sentAt":"2010-09-12T20:00:17Z","receivedAt":"2010-09-12T20:00:17Z","isPatch":false,"sender":{"key":"paragkalra@gmail.com","avatar":null},"body":"Thanks Ram.\n\ngit rm --cached was precisely what I was looking for.\n\nAlso .gitignore file worked without any issues.\n\nCheers,\nParag\n\n\n\n\nOn Sun, Sep 12, 2010 at 3:37 AM, Ramkumar Ramachandra\n<artagnon@gmail.com> wrote:\n> Hi Parag,\n>\n> Parag Kalra writes:\n>> 1. Is there a way I can make Git not track a particular folder in my\n>> working code base directory. For example, I have a tmp folder in my\n>> local code base and I don't want Git to track whats going on inside\n>> that directory.\n>\n> Yes. See gitignore (5).\n>\n>> 2. Accidently I have added this folder, committed and pushed it to\n>> origin master. Is there a way I can remove this tmp folder from git\n>> revision history and at the same time keeping it intact in my local\n>> code base directory.\n>\n> Yes. Simply `rm --cached` the folder, and amemd your previous commit\n> using `commit --amend`, and perform a non-ff push using the `+`\n> syntax. For example, to perform a non-ff push to remote branch `foo`\n> whose local name is `foo`, invoke `push +foo:foo`. Note that other\n> users who have already pulled the bad commit will have to forget about\n> it explicitly too.\n>\n> If the folder tracking information is a few revision deep, consider\n> using `rebase -i` to manually overwrite those commits to exclude that\n> folder. If the folder was too many revisions earlier, use a\n> `filter-branch` index filter to make Git completely forget that\n> folder.\n>\n> -- Ram\n>\n"}]}