Fetch all branches that match a pattern, ideas for API enhancements, and some bugs that were found
See original GitHub issueIt seems that if a branch has a disconnected history from the main branch, isomorphic-git fails to check it out. You can see the problem on this repository:
const git = require('isomorphic-git')
const fs = require('fs')
;(async () => {
await git.fetch({
fs,
dir: 'isogit',
url: 'https://github.com/isomorphic-git/isomorphic-git.git',
})
await git.checkout({
fs,
dir: 'isogit',
remote: 'origin',
ref: 'gh-pages',
})
})()
The error reported is:
Failed to read git object with oid e1593a418bbf61846ce6f044bd01c9cd3cde2004
If you change the ref from gh-pages
to develop
, it works fine.
Issue Analytics
- State:
- Created 6 years ago
- Comments:31 (31 by maintainers)
Top Results From Across the Web
Patterns for Managing Source Code Branches - Martin Fowler
There are several patterns that can allow teams to use branching effectively, concentrating around integrating the work of multiple developers and organizing ...
Read more >Your configuration specifies to merge with the <branch name ...
Your configuration specifies to merge with the ref 'refs/heads/feature/Sprint4/ABC-123-Branch' from the remote, but no such ref was fetched.
Read more >Protected branches API - GitLab Docs
Gets a list of protected branches from a project as they are defined in the UI. ... instead of the exact name of...
Read more >GitHub REST API Tutorial - REST API Support In GitHub
This GitHub Tutorial will explain how to use REST API for various actions to GET, PUT, POST, PATCH, DELETE data using the CURL...
Read more >Changelog - The GitHub Blog
Code security enablement settings on the list organization repositories REST API ... You can now view ( GET ) the security feature enablement...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll probably end up providing both. Some way to do remote reference discovery that essentially exposes
GitRemoteHTTP.discover()
to get the capabilities and references of a remote, and modifying “git.fetch” to accept an array ofrefspec
patterns. So it’ll probably end up looking a little more verbose, likerefspec: ['+refs/heads/master:refs/remotes/origin/master', '+refs/heads/v*:refs/remotes/origin/v/*']
. But it will also read the refspecs from.git/config
files, which means it’ll understand if you’ve configured your branch to pull from a different remote than ‘origin’ by default, and things like that.Ooh! That’s a great idea. That way listBranches and resolveRef work exactly the same way, and it elevates ‘remote’ to a common abstraction. You won’t have to be aware of the filesystem implementation (
refs/remotes/${remote}/branch
). And now I see I can fix git.checkout by changing it to checkout local branches by default instead of ‘origin’ by default. (A design flaw on my part that made checking out local branches impossible - oops!)