Git commits an empty directory under Windows

Source: Internet
Author: User

@echo  offsetlocal enabledelayedexpansionrem ++++++++++++++++++++++++++++++++++++rem pp:pre  process, preprocessing remrem  handling git ignores empty directory issues rem  Note: rem 1, the file is placed in the GIT project root directory, before Git add execute the file rem 2, New files will be added to the empty directory. Gitignore ignores the submission rem 3 and processing of all peer files: first delete all. Gitignore, then find all empty directories and add files 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)


Git commits an empty directory under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.