Bug 532956: Added an example to show complete git workflow.

This example shows how to use the methods in the Git module in order to
automatically clone a
remote repository, importing it into the workspace, adding a sample text
file and then finally add, commit and push back to the remote
repository.

Task-Url:https://bugs.eclipse.org/bugs/show_bug.cgi?id=532956

Change-Id: I2b1de182804bc807153a2b219f607078306f1fed
Signed-off-by: atharmasanthiran <aathmant.16@cse.mrt.ac.lk>
diff --git a/Git Example Script/.project b/Git Example Script/.project
new file mode 100644
index 0000000..6035e77
--- /dev/null
+++ b/Git Example Script/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Git Example Script</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+	</buildSpec>
+	<natures>
+	</natures>
+</projectDescription>
diff --git a/Git Example Script/example.js b/Git Example Script/example.js
new file mode 100644
index 0000000..460c2b7
--- /dev/null
+++ b/Git Example Script/example.js
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Aathman Tharmasanthiran and others. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors: Aathman Tharmasanthiran - initial API and implementation
+ ******************************************************************************/
+
+loadModule('/System/Git');
+loadModule('/System/Resources');
+
+var localRepo = "C:/New folder";
+var remoteRepo = "https://github.com/AathmanT/Example-codes.git";
+var username = "";
+var password = "";
+
+var gitRepo = clone(remoteRepo, localRepo, username, password);
+
+var projectFileLocations = findFiles("*.project", localRepo, true);
+
+for (var i = 0; i < (projectFileLocations.length); i++) {
+
+	linkProject((projectFileLocations[i]).getParent());
+}
+
+var fileHandle = writeFile(localRepo + "/Test file.txt",
+		"This is the test file added to test commit.");
+
+fileHandle.close();
+
+add(localRepo, "Test file.txt");
+
+commit(localRepo, "Added a test file", "AathmanT aathmant@gmail.com");
+
+push(localRepo);