Been trying to get branch switching working but I'm not having any luck. I found #523 and i _think_ i'm using the right api calls, but every time I try this code with a non-master branch, it fails with the error mentioned in the title.
Not sure if it matters, but the repo I've been testing with is http://github.com/codeimpossible/Artigo. I've been trying to switch from master, to the gh-pages branch.
let repository;
let fetch = git.Repository.open('path/to/local/repo');
return fetch.then((repo) => {
repository = repo;
return repo.fetchAll();
})
.then(() => repository.getBranchCommit('non-master-branch'))
.then((commit) => git.Branch.create(repository, 'non-master-branch', commit, true))
.then(() => repository.checkoutBranch('non-master-branch'))
Also, I've tried calling Repository#getReference directly and that fails as well.
Possibly related to #797. What is the actual branch you're trying to check out? origin/gh-pages?
in the code above I used 'gh-pages' instead of 'non-master-branch'. Should i have used 'origin/gh-pages' instead?
Yeah, that should work.
@johnhaley81 you are awesome. That worked!
Most helpful comment
@johnhaley81 you are awesome. That worked!