Cheats to ignore files in git

I have this clump in my ~/.bashrc …

This provides the following commands:

git-ignore /some/filename/
git-unignore /some/file/name

## Git stuff, helpers
git config --global AndyO
git config --global core.excludesfile ~/.gitignore
git_ignore () 
 if grep -e "^$1\$" ~/.gitignore; then
 echo $1 already ignored;
 echo $1 >> ~/.gitignore;
git_unignore ()
 sed -e "/^$( sed -e 's/[]\/()$*.^|[]/\\&/g' <<< $1 )\$/d" ~/.gitignore -i
alias git-ignore=git_ignore
alias git-ignore-list='cat ~/.gitignore'
alias git-unignore=git_unignore
alias git-unignore-all='( > ~/.gitignore)'

If you desired, you could easily change the functions to loop over $@ to allow the user to provide more than one filename at a time.


About andyortlieb

I've been a tinkerer and a lazy ideologist since I gained my first personal computer in 1989. I have an aversion to formal education and I prefer to learn things by experimentation. That is not a brag, it has not been a particularly helpful set of traits. My primary goals are to increase my safety, pleasure and usefulness as I work to build and modify technologies that will bring those same attributes to the masses irrespective of government. This is the documentation of my attempt at that journey.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s