Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Gitでコンフリクトしたファイルのファイル名のみを出力します
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import popen2
import re
def extractBothModifiedFileName():
r, w, e = popen2.popen3('git status')
for line in r:
if not line.find('both modified:') is -1:
yield re.split('[\t ]*', line.strip())[-1]
r.close()
w.close()
e.close()
if __name__ == '__main__':
print(' '.join(extractBothModifiedFileName()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment