The CloneRepository command seems to ignore the setBranch parameter if you aren't doing a checkout. Is there a way to specify the branch ( instead of the master )? I don't want to checkout the entire branch but I want to add a file to that branch ( add, commit, and push )
jgit - clone a branch of a repo without a checkout
2.9k Views Asked by user2242849 At
1
There are 1 best solutions below
Related Questions in REPOSITORY
- How to push a Git server repository issues to Github repository?
- escaping values in Spring Data Repository
- Duplicate entry '[X]' for key '[Y]' on JPA repository 'save' operation. Saved entity has its key defined already
- Mock service that takes unitOfWork in constructor
- How to turn local source code directory into remote git repo?
- Migrating Nexus repository manager
- How to configure authentication for access of repository in pom.xml?
- Get Record ID in Entity Framework 5 after insert
- Android Studio Best way import module from other repository
- Repository Pattern with Repository Factory
- Octokit.net Creating new repository
- No Author in SVN Repo Logs
- Attaching an entity of type '' failed because another entity of the same type already has the same primary key value
- mercurial - several projects and repositories
- Symfony2: How to Call functions in Repository class from Type
Related Questions in BRANCH
- How to have Heroku build my development branch on a staging server?
- Merge project from other branch git
- Delete branch in clearcase in Eclipse using GUI operation
- Modify files and commit after Branch creation in GIT via Hook
- How can I retrieve the local changed files which I wrongly reset in git
- Create a branch from master with removed code
- Can I use `diff ...` as an indicator for branch cleanup?
- Merging strategy with a long development branch. How to prevent heavy conflicts in the future merge?
- Checkout branch on different remote
- How to list remote branch without web request?
- Show git branch in file explorer
- Git won't see remote merge
- MIPS, why this branch doesn't work?
- Creating new branch in github but it isn't current?
- Associate specific paths in Atlassian Fisheye with Perforce branch mappings
Related Questions in CLONE
- Implementing ICollection.CopyTo in C#: deep or shallow copy?
- cloning a private bitbucket repository given access to me
- Cloning a Javascript object with its type
- jquery get() method , how exactly does it work?
- Cloned jQuery button makes more clones than expected
- Block "cloner" servers rendering content from our server
- Most efficient way to clone a list into an existing list, minimizing memory reallocation?
- Bootstrap Toggle for Checkbox adding extra div
- Clone Views in Android
- Duplicate table line with Jquery incrementing ID's
- cloneNode() changes attribute value in InternetExplorer 10 and 11
- Clone table row and increment IDs by 1
- In C#, what are some rules of thumb for _where_ to clone objects?
- jQuery functions not working on cloned element
- iOS : Clone repository issue with pod install
Related Questions in JGIT
- clone with jgit from gitlab
- nullpointerexception in BlameGenerator when executing sonar-runner
- JGit - Using parameters with LogCommand
- Checkout a specific revision based on the commit date with JGit
- Clone repository into existing directory using NGit / JGit
- File commit date in JGit
- List commits associated with a given tag with JGit
- Scala version of Jgit
- jgit - Delete .git directory (or get files without it)
- Does JGit API have all Git commands
- jgit - clone a branch of a repo without a checkout
- jGit CheckoutCommand results in a strange behaviour
- How do I rename a file in JGit
- addFilePattern does not throw FileNotFoundException if file to be added is not present
- jGit constructor error
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
This works for me when I use the existing snippet for cloning from the jgit-cookbook and only add the following at line 33:
After the snippet is executed, the local clone in the temporary directory has the given branch checked out.
Another option might be to use
org.eclipse.jgit.storage.dfs.InMemoryRepositoryto clone a Git repo in-memory and work from there.