Skip to content

Instantly share code, notes, and snippets.

@theeluwin
Created January 8, 2020 01:22
Show Gist options
  • Save theeluwin/c4d849f4f22e6ca7914cea4322b96ca8 to your computer and use it in GitHub Desktop.
Save theeluwin/c4d849f4f22e6ca7914cea4322b96ca8 to your computer and use it in GitHub Desktop.
gitignore 되어있는 폴더 트리를 구조만 유지하고 싶을때 .keep을 추가해서 처리
# -*- coding: utf-8 -*-
import os
import subprocess
def entry():
for root, _, _ in os.walk('.', topdown=True):
if root == '.':
continue
path = os.path.join(root, '.keep')
with open(path, 'w') as _:
pass
subprocess.call(['git', 'add', '-f', path])
if __name__ == '__main__':
entry()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment