Monday, June 2, 2014

git delete-untracked

Want to delete all files that have not been added to your git repo?

Create a Git Alias

You can create a global git aliases like this:

$ git config --global alias.delete-untracked '!f() { (echo "";echo "THE FOLLOWING FILES WILL BE DELETED:";git clean -f --dry-run; echo "";echo "ARE YOU SURE? (CTRL+C TO ABORT --OR-- ENTER TO CONTINUE...)";read x; echo "";echo "THE FOLLOWING DIRECTORIES WILL BE REMOVED:";git clean -f -d --dry-run; echo "";echo "ARE YOU SURE? (CTRL+C TO ABORT --OR-- ENTER TO CONTINUE...)";read x;set -x;git clean -f; git clean -f -d); }; f'


See reference link below for more handy git aliases.


References

http://lexsheehan.blogspot.com/2014/05/git-add-update.html

No comments:

Post a Comment