* Computer Science/py

git bash에서 파이썬으로 git untracked files 제거

soicem 2018. 8. 15. 03:50

1. open git bash

2. git ls-files

3. 2번의 결과물 중 untracked file로 지정할 파일을 긁어서 untracked.txt로 같은 dir에 저장

4. $python 아래소스.py

1
2
3
4
5
6
7
8
import os
 
= open('./untracked.txt''r')
while True:
    line = f.readline()
    if not line: break
    bashCommand = "git rm --cached " + line
    os.system(bashCommand)
cs

 5. git ls-files로 확인

'* Computer Science > py' 카테고리의 다른 글

bulk printer with py  (0) 2018.12.07
collections  (0) 2018.07.09
Asterisk  (0) 2018.07.09
zip, enumurate, lambda, map reduce  (0) 2018.07.09
join & traslate & title  (0) 2018.03.04