Skip to content

Instantly share code, notes, and snippets.

@kristofmeixner
Created July 12, 2016 06:38
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 kristofmeixner/cc0d6bee550b701ab3c2ae6add75aee8 to your computer and use it in GitHub Desktop.
Save kristofmeixner/cc0d6bee550b701ab3c2ae6add75aee8 to your computer and use it in GitHub Desktop.
Creating the CSV and metadata branch
Git git = new Git(repository);
// Creating the master branch if it doesn't exist
ObjectId head = repository.resolve("refs/heads/master");
if (head != null) { return; }
// Creating the initial commit on the branch
git.commit().setMessage("Initial commit").call();
String readmeFileName = "README.md";
String[] text = new String[] {"DO NOT DELETE DIR"};
Files.write(Paths.get(getWorkingTreeDir(), readmeFileName), Arrays.asList(text));
git.add().addFilepattern(readmeFileName).call();
PersonIdent personIdent = new PersonIdent("Jane Doe","doe@gmail.com");
git.commit().setMessage("README.md").setAuthor(personIdent).call();
// Creating the orphaned queries branch if it doesn't exist
ObjectId head = repository.resolve("refs/heads/queries");
if (head != null) { return; }
// Creating the initial commit on the branch
git.checkout().setName("queries").setOrphan(true).call();
git.commit().setMessage("Initial commit").call();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment