JAVASCRIPT Merge a branch back into Main

I cannot find the javascript merge branch command.

I created branch_l from Main:

let branchName=“branch_1”
client.branch(branchName)
.then((results) => {
console.log(‘results’, results)
})
.catch((err) => console.log(‘error’, err))
.finally(() => console.log(‘do anything’))

Now I want to Merge branch_1 back into Main.
You would think a client.merge(…) would exist.

Please respond.
Thanks

Hi orioncri,

We do have a command which merges a branch into current branch. So if you checkout to Main branch and do a rebase as shown below branch_1 will be merged to main branch.

    let branchName=“branch_1”
    var rebase_source = {} 
    rebase_source.rebase_from = branchName
    rebase_source.message = "some commit message"
              
    client.rebase(rebase_source).then(() => {console.log("Success in merge, do something")})
          .catch((err) => {console.log("Error in merge, do something")})
          .finally(() => {console.log("do something")})

Refer - rebase() in https://terminusdb.com/docs/reference/js-client/core/#rebase

1 Like