Skip to content

Instantly share code, notes, and snippets.

@narusemotoki
Created November 4, 2012 03:06
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 narusemotoki/4009939 to your computer and use it in GitHub Desktop.
Save narusemotoki/4009939 to your computer and use it in GitHub Desktop.
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