79 lines
2.9 KiB
PowerShell
79 lines
2.9 KiB
PowerShell
# Git忽略文件处理工具
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host "Git Ignore File Check Tool" -ForegroundColor Green
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host "This script checks files and folders that don't need to be uploaded to Git repository" -ForegroundColor Green
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
|
|
# 建议忽略的文件和文件夹
|
|
Write-Host "Suggested files and folders to ignore:" -ForegroundColor Cyan
|
|
Write-Host "1. IDE configuration: .idea, .vs, *.suo, *.user" -ForegroundColor White
|
|
Write-Host "2. Build output: bin, obj" -ForegroundColor White
|
|
Write-Host "3. Temporary files: *.cache" -ForegroundColor White
|
|
Write-Host "4. Large files: *.zip, *.apk" -ForegroundColor White
|
|
Write-Host "5. Database files: App_Data/*.mdb, App_Data/*.xls" -ForegroundColor White
|
|
Write-Host ""
|
|
|
|
# 检查当前目录结构
|
|
Write-Host "Checking current directory structure..." -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
Write-Host "Found folders:" -ForegroundColor Cyan
|
|
Get-ChildItem -Directory | Select-Object Name
|
|
Write-Host ""
|
|
|
|
Write-Host "Found files:" -ForegroundColor Cyan
|
|
Get-ChildItem -File | Select-Object Name
|
|
Write-Host ""
|
|
|
|
# 检查是否存在需要忽略的文件
|
|
Write-Host "Checking for files to ignore..." -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# 检查.idea目录
|
|
if (Test-Path ".idea") {
|
|
Write-Host ".idea directory exists, suggest to ignore" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host ".idea directory does not exist" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
|
|
# 检查.vs目录
|
|
if (Test-Path ".vs") {
|
|
Write-Host ".vs directory exists, suggest to ignore" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host ".vs directory does not exist" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
|
|
# 检查bin目录
|
|
if (Test-Path "bin") {
|
|
Write-Host "bin directory exists, suggest to ignore" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host "bin directory does not exist" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
|
|
# 检查obj目录
|
|
if (Test-Path "obj") {
|
|
Write-Host "obj directory exists, suggest to ignore" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host "obj directory does not exist" -ForegroundColor Green
|
|
}
|
|
Write-Host ""
|
|
|
|
# 检查大文件
|
|
Write-Host "Large files found:" -ForegroundColor Cyan
|
|
Get-ChildItem -File -Include *.zip, *.apk | Select-Object Name
|
|
Write-Host ""
|
|
|
|
# 显示完成信息
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host "Check completed!" -ForegroundColor Green
|
|
Write-Host "Suggest to create a .gitignore file in the project root directory" -ForegroundColor Green
|
|
Write-Host "with the above rules." -ForegroundColor Green
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Press any key to exit..." -ForegroundColor Cyan
|
|
$host.UI.RawUI.ReadKey() |