windows下git提交空目錄

來源:互聯網
上載者:User

標籤:

@echo offsetlocal enabledelayedexpansionrem ++++++++++++++++++++++++++++++++++++rem pp:pre process,預先處理remrem 處理git忽略空目錄的問題rem 注意:rem 1、該檔案放在git項目根目錄,在git add之前執行該檔案rem 2、在空目錄下會新增檔案,新增.gitignore會忽略平級所有檔案的提交rem 3、處理過程:首先刪除所有.gitignore,然後尋找所有空目錄並新增檔案remrem ++++++++++++++++++++++++++++++++++++(for /r %%i in (*.gitignore) do (if not %%~fi == %cd%\.gitignore (echo %%~fi  -- prepare to deletedel "%%~fi"if ERRORLEVEL 0 (echo %%~fi -- success to delete) else (echo %%~fi -- fail to delete)))del pp_dir_all > nul 2>nuldel pp_dir_filter > nul 2>nulfor /d %%i in (*) do (for /f "delims=" %%j in (‘dir /s /b /ad "%%~fi"‘) do (echo %%~fj -- prepare to collectecho %%j>> pp_dir_all))if exist pp_dir_all (for /f "delims=" %%i in (pp_dir_all) do (echo %%i -- prepare to check children countset /a children_count=0for /f "delims=" %%j in (‘dir /b "%%~fi"‘) do (echo %%~fj -- print childrenset /a children_count+=1)echo %%i -- child_count: !children_count!if !children_count! == 0 (echo %%i -- none childrenecho %%~fi>> pp_dir_filter )))if exist pp_dir_filter (for /f "delims=" %%i in (pp_dir_filter) do (echo %%i -- prepare to create .gitignore fileecho * > "%%i\.gitignore"if ERRORLEVEL 0 ( echo %%~fi -- success to create ) else ( echo %%~fi -- fail to create )))del pp_dir_all > nul 2>nuldel pp_dir_filter > nul 2>nulrem echo. & pause rem ) > nul 2>nul) > pplog.txtecho. >> pplog.txtecho. >> pplog.txtecho. >> pplog.txtecho. >> pplog.txtecho. ** current .gitignore list>> pplog.txtecho. >> pplog.txtfor /r %%i in (*.gitignore) do (echo %%~fi >> pplog.txt)


windows下git提交空目錄

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.