From: Joshua Juran Date: Tue, 20 Jul 2010 05:17:58 GMT Subject: Re: Automatically exclude hunks from the commit Message-ID: In-Reply-To: <4C4511C8.8090405@workspacewhiz.com> On Jul 19, 2010, at 8:02 PM, Joshua Jensen wrote: > I have some files I update frequently where I have some normally > commented out debug code purposely uncommented during development. > Git's hunk-level staging saves the day. I can stage everything but > the debug code without issue. > > This got me to thinking. Is there a better way? Is there a > facility in Git where I could mark a hunk as 'permanently frozen > unstaged'? Anything marked as such would never be staged for > commit. I could rest assured I would never accidentally commit my > debug code, be it extra printfs or a development server or a > password or so on. How about keeping your debug changes in a separate branch? I work on a branch called 'hack', to which I'll commit pretty much anything. When a patch is ready, I cherry-pick it from master and rebase hack onto master.[1] Passwords which are so sensitive that they can't ever be checked in should be stored in ignored files or outside the repo entirely. Josh [1] It's actually more complicated than that. I create 'tip' as a merger of master and my formal topic branches, and hack stays rebased on tip.