Skip to content

Cannot create a new branch #391

@ashokfernandez

Description

@ashokfernandez

I am trying to create a new branch in my repo, however I am getting an error about a callback not existing. This is using version 0.2.7 from NPM

Git = require('nodegit');

scope = {}

Git.Repository.open("./")
    .then(function(repo) {
        scope.repo = repo;
        return repo.getMasterCommit();
    })
    .then(function(masterCommit) {
        scope.masterCommit = masterCommit;
        return Git.Branch.create(scope.repo, "new-branch", scope.masterCommit, true)
    })
    .then(function(branch) {
        console.log(branch.toString())
    })
    .catch(function(err) {
        console.log(err.toString())
    })

This results in the output

Error: Callback is required and must be a Function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions