Clear out compiled Python from a git repository

Making a GitHub repository of a Python project, you are likely to have a bunch of the compiled Python files included too. These are useless – they are produced at runtime if needed – and clutter up the repo.

There is an easy way to get rid of them after you realise your mistake. The second step involves editing .gitignore , the file that tells git what files to ignore. I prefer to use nano on the Mac, because it gives a little cheat sheet at the bottom of its display.

nano .gitignore

and add the one line.

*.pyc

Thanks to Yuji Tomita for the tip.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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