This article is a mirror article of machine translation, please click here to jump to the original article.

View: 2647|Reply: 0

Git cleanup deletes unmanaged (untracked) files

[Copy link]
Posted on 9/1/2024 8:26:09 PM | | | |
Requirements: A .NET project that uses git to manage the source code now needs to be sent or backed up, and the project contains a large number of temporarily ignored files, such as package, obj, bin, etc. If you compress it directly, it will be very large, so how to delete files that are not managed by git tracking?

git-clean command

This command is to delete untracked files from the working tree, first use the command to view the files that will be deleted, the command is as follows:



I found that there was no output, and the file content was contained under the obj and bin directories. The reason is that rules configured within .gitignore are ignored by default.

You need to add the -x parameter with the following command:



Then execute the delete command as follows:




Reference:The hyperlink login is visible.




Previous:Push projects to multiple git repositories
Next:Windows Reset PC (System Restore) Wipe the disk
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com