Useful terminal commands to keep workspace clean

Reading Time: < 1 minute

1. Find and delete all empty folders in the directory

find . -empty -type d -delete


2. Find and delete all the branches, that no longer has tracked a remote branch

git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done


The post will be updated.

If you are using any terminal commands repeatedly, please, share them in the comments.

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Olena Sovyn
Staff Software Engineer (London, UK). I ❤ React, Redux, lodash, React Storybook, and functional programming overall. Always open to learning something new

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Spelling error report

The following text will be sent to our editors: