Skip to content

Instantly share code, notes, and snippets.

@pfctgeorge
Created March 29, 2014 17:23
Show Gist options
  • Save pfctgeorge/9858456 to your computer and use it in GitHub Desktop.
Save pfctgeorge/9858456 to your computer and use it in GitHub Desktop.
add and commit every file in a directory separately
import os
from subprocess import check_call
filenames = list(os.walk("."))[0][2]
for filename in filenames:
if filename.endswith(".java"):
classname = filename.partition(".java")[0]
check_call(["git", "add", filename])
check_call(["git", "commit", "-m",
"reformat code in services.%s." % classname])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment