Skip to content

Instantly share code, notes, and snippets.

@hatzopoulos
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save hatzopoulos/4265d412296dc995ec07 to your computer and use it in GitHub Desktop.

Select an option

Save hatzopoulos/4265d412296dc995ec07 to your computer and use it in GitHub Desktop.
linux bash and git tricks
# find and group by extension
# http://serverfault.com/a/183432/128858
find ./ -type f -not -path "./.git/*" | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
      1 .GIF
      1 .JPG
      1 .bash
      1 .bmp
      1 .cfm
      1 .html
      1 .info
      1 .module
      1 .otf
      1 .xml
      2 .asp
      2 .htaccess
      2 .md
      3 .gdf
      5 .swf
     30 .eot
     30 .woff
     34 .json
     34 .ttf
     39 .css
     45 .svg
     93 .gif
    107 .txt
    111 .sql
    130 .js
    224 .jpg
    267 .less
    304 .tpl
    603 .png
   2729 .php
git shortlog --summary --numbered --since="01-Jun-2015" --until="30-Jun-2015"

clone an orphan branch of some git remote and nuke all the files

BRANCH='REPLACE-WITH-YOUR-NEW-BRANCH-NAME' && \
REPO='REPLACE-WITH-THE-REPO-URI' && \
git clone --single-branch $REPO $BRANCH && \
cd $BRANCH && \
git checkout --orphan $BRANCH HEAD && \
git rm -rf .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment