Devops, Troubleshooting, Ubuntu

Cleanup source from .git artifacts (tronsmart android source)

Was spending these couple of days to compile `Tronsmart’s Draco H3 Android` . The SDK that they provide are 15 Gigabytes in size >_<

Not really sure why they just archive their work folder like that, 15 gigs in itself is a zip full of compiled binaries, few android compiled images, broken symbolic links, nested `.git` folders and hosted on mediafire to download. (Now.. compiling this will be a long journey in itself :P)

So anyhow I clean `.git` artifacts recursively for some rooms to breathe. (besides the `.git` is not usable since it’s point to their internal development server)

To list all files, grep ones with `.git` in the path and then delete it

 find . | grep \\.git | xargs rm -rf 

Keep in mind that grep is using regex so the expression above will be matched with anything that have `.git` in it (nested .git folder, all files inside that git folder, .gitignore, .gitkeep, whatever.git.whatever etc.)

If you are not really sure and want to check what files that are going to be removed. Just use `echo` to test it, It will list all files that matched the expression

 find . | grep \\.git | xargs echo 

 

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