Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Fetching/checking out files without Cloning the Entire GIT Repository
Fetching/checking out files without Cloning the Entire GIT Repository [message #1724558] Wed, 24 February 2016 16:00 Go to next message
Jack WC is currently offline Jack WCFriend
Messages: 2
Registered: February 2016
Junior Member
I have tens of thousands of files in a GIT Remote Repository within the Master branch. Each set of files are organized within a folder/subfolder structure.

At a given time, I only need 5 files. If there a way for me to 'fetch' those 5 files without cloning master branch of the GIT Repository onto my local machine? If so, how can I do this?
Re: Fetching/checking out files without Cloning the Entire GIT Repository [message #1724936 is a reply to message #1724558] Sat, 27 February 2016 10:53 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1058
Registered: July 2009
Senior Member
You can't since Git is a distributed repository which requires that you first clone the repository.

You can leave out branches you don't need (EGit's clone wizard has a page to select which ones should be cloned).
In native git you can use [1]
$ git clone --single-branch --branch <branch name>
to achieve that.

And, if you are using native git, you can use shallow clone to not fetch all versions [1]
$ git clone --depth <n>

But selectively fetching only a few files is not supported through standard git protocol.
Specific git servers may provide additional, non-standard APIs to enable such operations.

[1] https://git-scm.com/docs/git-clone
Previous Topic:Searching a git project
Next Topic:Double click in staging view doesn't open compare editor any more
Goto Forum:
  


Current Time: Wed May 22 20:44:17 GMT 2019

Powered by FUDForum. Page generated in 0.01403 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top