Checkout subdirectories in Git?

Is it possible to check out subdirectories of a repository in Git? Imagine I am setting up a new WordPress installation. I will create two new directories for my plugin and theme...

How do I clone a subdirectory only of a Git repository?

I have my Git repository which, at the root, has two sub directories: /finisht /static When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like...

Retrieve a single file from a repository

What is the most efficient mechanism (in respect to data transferred and disk space used) to get the contents of a single file from a remote git repository? So far I've managed to come up...

Is it possible to do a sparse checkout without checking out the whole repository first?

I'm working with a repository with a very large number of files that takes hours to checkout. I'm looking into the possibility of whether Git would work well with this kind of repository now that...

Git sparse checkout with exclusion

According to this thread, exclusion in Git's sparse-checkout feature is supposed to be implemented. Is it? Assume that I have the following...

How to git reset --hard a subdirectory?

UPDATE²: With Git 2.23 (August 2019), there's a new command git restore that does this, see the accepted answer. UPDATE: This will work more intuitively as of Git 1.8.3, see my own...

Git Sparse Checkout Leaves No Entry on Working Directory

I am trying to use sparse-checkout to just check-out a directory from a BitBucket repository, but getting a "Sparse checkout leaves no entry on working directory" error when I try to pull. The...

Sparse Checkout with Jenkins DSL Plugin?

Does anyone have a code sample for the correct configure { ... } block needed in the Jenkins DSL plugin to set up a git sparse checkout? It appears as if the config.xml section looks like...

Why does one call `git read-tree` after a sparse checkout

According to Subdirectory Checkouts with git sparse-checkout one calls git read-tree -mu HEAD after configuring a sparse checkout in the case of an already existing repository, i.e.: # Enable...

Git commit/Push/Pull with sparse checkout

I started Git yesterday and before that I was using SVN since many years. Let me explain you what exactly I am trying to achieve: I have a main git repo for different projects. Something like...

libg2o linker errors on OS X

I am getting the following linker errors: cd /Users/mhoggan/Development/bluenote/image_pose_adjustment/image_pose_adjustment/native/graph/cmake-build-debug/src &&...

How to do submodule sparse-checkout with Git?

There are a lot of articles and SO questions about sparse-checkout. Unfortunately I did not find concrete examples. I would like to get this following example work: Create a submodule cd ~ mkdir...

Git clone subdirectory into Android Studio

I'm having hard time checking out a GitHub sub directory as a project into Android Studio. I could clone the main directory: main repository But I really need to clone one of the...

Is it possible to maintain two local Git repositories with entirely different content, but push them to the same remote repository?

I'm a graduate student experimenting with using Github for science. Often I might perform different tasks for the same project on different servers. I don't always want all of these functions on...

How to do a sparse checkout and update from SVN on Jenkins?

We have a large SVN repository and I would like to do a sparse checkout on Jenkins. I do understand the concept of sparse checkouts and having it locally I can get things to work as I would like...

Checkout part of a branch in Azure DevOps Pipelines (GetSources)

My repository in my organisation's devops project contains a lot of .net solutions and some unity projects as well. When I run my build pipeline, it fails due to several of these: Error MSB3491:...

Git sparse checkout: adding directories to existing list is not recognized

Situation I managed to create a local git repository in my laptop by pulling a single subdirectory of the master branch in a remote repository. I have followed the instructions given in this post...

git describe --tags does not work on Jenkins pipeline build

I've seen this question which goes in a similar direction but not quite. The problem there was that the tags were simply not pushed correctly. I am currently using Jenkins to build my python...

How do I clone, fetch or sparse checkout a single directory or a list of directories from git repository?

How do I clone, fetch or sparse checkout a single file or directory or a list of files or directories from a git repository avoiding downloading the entire history or at least keeping history...

git sparse checkout - can't abort merge

Using git 2.25.1 Used git sparse-checkout init/set to setup sparsecheckout. Now I'm in situation that i need to abort merge. Tried: git merge --abort Entry...

Git and sparse-checkout on large monorepos - hiding irrelevant changes for a sparse-checkout specification? (git-diff, git-log, etc)

As git is increasingly advertised (and enhanced) to better support very large repositories (so-called "monorepos"), with major recent enhancements to the sparse-checkout workflow...

How to use git sparse-checkout in 2.27+

I was trying to reproduce the few tutorial steps from: https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout Which was made for git 2.25, but now in 2.27, nothing...

github/git Checkout Returns 'error: invalid path' on Windows

When I attempt to checkout a repository from github I get the error: error: invalid path 'configs/perl-modules/DIST.64/perl-HTML-Tree-1:5.03-1.el6.noarch.rpm' I suspect the issue is that the...

Gvim/Git Plugin error E492: Not an editor command: GitStatus

First, I assume this is a problem with how I installed things and not an issue with the package. On Windows, I downloaded the zip file for the Git plugin for Vim...

Git sparse-checkout not getting any folders

I wanted to clone just a folder from a repo on Github, am not sure if am using the sparse checkout correctly, but the docs here isn't giving any examples so am fiddling through blog posts to try...

Git monorepo layout with shared library

We have two projects A and B with shared library L. To avoid duplication of L' s history, we are considering to set up a Git monorepo which will contain A, B and L on the top-level: / +-- L | ...

Why does git think I have a sparse checkout? "You are in a sparse checkout with 100% of tracked files present."

Background: recently setup a new laptop, and zip'd my repo up from the previous laptop and unzipped on the new laptop. Everything else seems to be working fine. I've never made a sparse checkout...

Azure Pipeline, Cannot prompt because terminal prompts have been disabled

I am trying to set up my pipeline to only checkout specific folders related to a project so that I can reduce the checkout time. I am using the following code found on many other questions but I...

Sparse checkout but exclude or ignore files in root?

The docs for git sparse-checkout state, By default, when running git sparse-checkout init, the root directory is added as a parent pattern. At this point, the sparse-checkout file contains the...

In Jenkins, how do I set SCM behavior for the master node rather the build nodes?

I'm aware I'm lacking basic Jenkins concepts but with my current knowledge it's hard for to research successfully - maybe you can give me some hints I can use to re-word my question if...