Skip to content

Instantly share code, notes, and snippets.

@samrocketman
Last active June 23, 2024 10:22
Show Gist options
  • Save samrocketman/7bda56b09e6239a6faa5 to your computer and use it in GitHub Desktop.
Save samrocketman/7bda56b09e6239a6faa5 to your computer and use it in GitHub Desktop.
A gitignore for ignoring common binary files
#common document extensions (case insensitive)
**.[pP][dD][fF]
**.[dD][oO][cC]
**.[dD][oO][tT]
**.[dD][oO][cC][xX]
**.[dD][oO][cC][mM]
**.[dD][oO][tT][xX]
**.[dD][oO][tT][mM]
**.[dD][oO][cC][bB]
**.[pP][pP][tT][xX]
**.[pP][pP][tT][mM]
**.[pP][oO][tT][xX]
**.[pP][oO][tT][mM]
**.[pP][pP][aA][mM]
**.[pP][pP][sS][xX]
**.[pP][pP][sS][mM]
**.[sS][lL][dD][xX]
**.[sS][lL][dD][mM]
**.[pP][pP][tT]
**.[pP][oO][tT]
**.[pP][pP][sS]
**.[xX][lL][sS][bB]
**.[xX][lL][aA]
**.[xX][lL][aA][mM]
**.[xX][lL][lL]
**.[xX][lL][wW]
**.[xX][lL][sS]
**.[xX][lL][sS][xX]
**.[xX][lL][tT]
**.[xX][lL][mM]
#common image extensions (case insensitive)
**.[tT][iI][fF]
**.[tT][iI][fF][fF]
**.[gG][iI][fF]
**.[jJ][pP][eE][gG]
**.[jJ][pP][gG]
**.[jJ][iI][fF]
**.[jJ][fF][iI][fF]
**.[jJ][pP]2
**.[jJ][pP][xX]
**.[jJ]2[kK]
**.[jJ]2[cC]
**.[fF][pP][xX]
**.[pP][cC][dD]
**.[pP][nN][gG]
**.[pP][sS][dD]
**.[xX][cC][fF]
#common video extensions (case insensitive)
**.[wW][eE][bB][mM]
**.[mM][kK][vV]
**.[fF][lL][vV]
**.[vV][oO][bB]
**.[oO][gG][vV]
**.[oO][gG][gG]
**.[dD][rR][cC]
**.[mM][oO][vV]
**.[qQ][tT]
**.[mM][nN][gG]
**.[aA][vV][iI]
**.[wW][mM][vV]
**.[yY][uU][vV]
**.[rR][mM]
**.[rR][mM][vV][bB]
**.[mM][pP]4
**.[mM]4[pP]
**.[mM]4[vV]
**.[mM][pP][gG]
**.[mM][pP]2
**.[mM][pP][eE][gG]
**.[mM][pP][eE]
**.[mM][pP][vV]
**.[mM]2[vV]
**.[sS][vV][iI]
**.3[gG][pP]
**.3[gG]2
**.[mM][xX][fF]
**.[rR][oO][qQ]
**.[nN][sS][vV]
#common audio extensions (case insensitive)
**.[aA][cC][tT]
**.[aA][iI][fF][fF]
**.[aA][aA][cC]
**.[aA][mM][rR]
**.[aA][uU]
**.[aA][wW][bB]
**.[dD][cC][tT]
**.[dD][sS][sS]
**.[dD][vV][fF]
**.[fF][lL][aA][cC]
**.[gG][sS][mM]
**.[iI][kK][lL][aA][xX]
**.[iI][vV][sS]
**.[mM]4[aA]
**.[mM][mM][fF]
**.[mM][pP]3
**.[mM][pP][cC]
**.[mM][sS][vV]
**.[oO][gG][aA]
**.[oO][pP][uU][sS]
**.[rR][aA]
**.[rR][aA][wW]
**.[sS][lL][nN]
**.[tT][tT][aA]
**.[vV][oO][xX]
**.[wW][aA][vV]
**.[wW][mM][aA]
**.[wW][vV]
@samrocketman
Copy link
Author

Put that at the root of your repository and:

#download the gitignore file
curl -o .gitignore https://gist.githubusercontent.com/samrocketman/7bda56b09e6239a6faa5/raw/fa727f084ef926916ca43f04e0d654785e588347/.gitignore
#rename your old master branch to create a "new project" while preserving the old one.
git checkout master
git branch -m old-master
#create a "new project" at a new master branch
git checkout --orphan master
git reset
git add .
git commit -m 'Initial commit'

@samrocketman
Copy link
Author

The old-master branch will be the copy that contains all of the media files. The new master branch will be your source without the media files and will be a lot smaller. To push the new master branch to your git remote just execute:

git push origin -u master --force

Note -u will set the upstream branch for your local master to track the origin/master branch. You only need to do that once. --force will delete your remote master branch (if you have one) and force it to be your current master branch.

Once your new master branch is hosted you can just git push normally.

git push
#or if you want to be explicit
git push origin master

@RamonGiovane
Copy link

It's missing xlsx.
Just add:
**.[xX][lL][sS][xX]

@samrocketman
Copy link
Author

Done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment