Skip to content

Latest commit

 

History

History
67 lines (45 loc) · 1.19 KB

general.md

File metadata and controls

67 lines (45 loc) · 1.19 KB

General scripts

Delete file or directory

  • Delete all migrations of a Django project

    find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
  • Delete __pycache__ files

    find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

Content

  • Clear content file

    echo -n "" > <file_name>
  • Check differences between two files

    diff <file_name_1> <file_name_2>
  • Copy content into the clipboard from a file

    pbcopy < <file_name>

    Example:

    pbcopy < git-logs.txt

Git

  • Export git commits

    git log --since="<date>" --author="<email or name>" --reverse --pretty=format:"%h,%an,%ar,%s" > <file_name>

    Example:

    git log --since="yesterday" --author="John Tamayo" --reverse --pretty=format:"- %s" > git-logs.txt
    git log --since="last week" --author="John Tamayo" --reverse --pretty=format:"- %s" > git-logs.txt
    git log --since="march 31 2019" --author="John Tamayo" --reverse --pretty=format:"- %s" > git-logs.txt
    git log --since="03-31-2019" --author="John Tamayo" --reverse --pretty=format:"- %s" > git-logs.txt