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 answers
Related Questions in REPOSITORY
- Cant connect to any github repository from my netbeans 20
- Save Interface in DB golang
- Files lost from Github repository
- Single Github repository for two local repos for a fullstack project
- Git Webhook to trigger SageMaker Pipeline
- Need more parameters in subclass overridden method
- Build code in new cpp file in a cloned repository
- Troubleshooting Azure DevOps External Repository Cloning Authentication Issue
- How to have helm / helmfile install the most recent chart version from a repo?
- Can't able to merge branch to main branch in github
- I was a contributor on a Github repository that does not exist anymore. I still have those files on my computer. How do I upload the files to Github?
- Spring can't find the specified Bean
- Create SFDX project vs code from repository?
- Magnolia Git Repo Documentation Access
- Conditionnal repositories in Golang
Related Questions in BRANCH
- Xcode commits (possibly outside of any branch) disappeared, how to get them back?
- How to fix "this branch is 1 commit behind of master branch"
- How can I merge these two branches?
- Is there any way for QA to do the feature testing before each feature merged to sacred branches?
- speed up git clone when remote have so many branches
- Cleaning master branch to version from another branch, but save progress to new temp branch
- In Git how can I cycle through previously checked out branches?
- Feature and origin/Feature are separated in a Y shape
- Git how to pull the update from original repository and keep my own changes
- Pull request from feature branch into test branch shows changes that are already inside test branch
- Git rev-parse --abbrev-ref HEAD vs branch --show-current differences in a new init project
- git forward merging a couple of commits only
- ADF Publish Fail - Invalid references or dependencies found
- Merge dev to stage but only specific commits
- Odoo 17 Branches Configuration
Related Questions in CLONE
- Leetcode 1255-recursion and backtracking
- Forking vs Cloning in GitHub
- Trying to run a "uber clone" from github in react native ( vs code )
- I can“t clone my github repository with a ssh key
- Laravel 9 $model->replicate() is not immutable
- Cloning resources group into another
- A way to declare and clone a cloneable (#[derive(Clone)]) struct with a type parameter and a field that is an Arc of an uncloneable type in Rust?
- GIT repo with submodule that can point to two different repositories
- Site Not Found Error After Deployed in Firebase
- PHP Cloning an object when a reference exists breaks the clone
- Git how to pull the update from original repository and keep my own changes
- git svn clone does not grab a branch not in stdlayout
- PDO clone a record then open cloned record to edit
- Problem in Hover Animation in a ReactJS Component
- How to clone an element on click in React.js
Related Questions in JGIT
- JGit, remove tags no longer in remote
- Jgit Fixup, Squash Interactive Rebase is not working properly
- Git clone failed with Krb5LoginModule error - JNA Library
- jGit Push not always visible in GitHub Activity page
- CONNECT through proxy removes additional headers required for authorization
- In java JGit, How to remove all commits from remote repository except the most recent one
- JGit and blobless clone: unable to fetch blobs later
- Static Code Analysis using Java, JGit, PMD
- jGIT Track File Location Change
- How does Jgit obtain the code diff information of the historical commitid that has been rebased?
- Create git repo with jgit and put a file into it
- How to use JGit to view modifications in the local workspace?
- release-start showing 'Working tree has uncommitted changes' but git status has 'nothing to commit'
- Why is a JGit shallow clone not faster than a full clone?
- JGit failure in Cloning repository
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?
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)
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.