git_cleanup
This script will do the following:
-
remove untracked files from the working tree
-
remove any remote-tracking references that no longer exist on the remote
-
cleanup remote branches
-
cleanup unnecessary files and optimize the local repository
The following parameters are supported:
d
-
the directory (
$PWD
if not given) containing the Git repository to clean e
-
prune entries older than the argument; default:
1.month.ago
n
-
Do not actually clean anything, just show what would be done.
This script will remove all untracked files. Sometimes you have untracked files which you do not want to be cleaned up. For example:
Add them to the exclusions to ensure that they will not be removed: scripts/git-cleanup.sh
|
By default, the metadata files of Eclipse, JetBrains IDEs, and Visual Studio Code are not removed. |
Copy this script into your project:
|