We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 417cb4f commit 2627e28Copy full SHA for 2627e28
examples/create-branch.js
@@ -0,0 +1,21 @@
1
+var nodegit = require("../");
2
+var path = require("path");
3
+var Promise = require("nodegit-promise");
4
+var promisify = require("promisify-node");
5
+var fse = promisify(require("fs-extra"));
6
+
7
+nodegit.Repository.open(path.resolve(__dirname, "../.git"))
8
+ .then(function(repo) {
9
+ // Create a new branch on head
10
+ return repo.getHeadCommit()
11
+ .then(function(commit) {
12
+ return repo.createBranch(
13
+ "new-branch",
14
+ commit,
15
+ 0,
16
+ repo.defaultSignature(),
17
+ "Created new-branch on HEAD");
18
+ })
19
+ }).done(function() {
20
+ console.log("All done!");
21
+ });
0 commit comments