Skip to content

Instantly share code, notes, and snippets.

@snargledorf
Created February 20, 2012 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snargledorf/1870781 to your computer and use it in GitHub Desktop.
Save snargledorf/1870781 to your computer and use it in GitHub Desktop.
Scripts for creating a .gitignore using drag and drop.
:: To use drag and drop the files/folders you would like to ignore onto the script.
:: A .gitignore file will be created in the root directory of the files/folders that you drop on the script
:: Ex. I want to hide the file 'C:\myrepo\filetohide.txt'
:: When I drop this file onto this script a .gitignore
:: file will be created at 'C:\myrepo\.gitignore'.
:: Originaly created by Ryan Esteves 1/19/2011
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
for %%A in (%*) do (call :sub %%A)
goto end
:sub
set "dir=%~dp1"
set "out=%~1"
if not ("!out!"=="") (
for %%i in (!out!) do (
if exist %%~si\nul (
set "out=!out!/"
)
)
set "out=!out:%dir%=!"
set "out=!out:\=/!"
echo !out!>>.gitignore
echo !out! added
)
goto :EOF
:end
PAUSE
# Coming Soon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment