here is my git server tree:
----a/
|--b/
|--c/
|--d/
|--e/
|--f/
|--g.txt
|--h.readme
here is my git version tree
---------------->master
|---->myBranch [files are up to date here]
here is my jenkins server tree
-----A/
|--B/
|--C/
I am trying to checkout the content of repository "e" in repository "B"
I just need the last version of the current branch i'm working on, and I don't want to commit, just to get some up-to-date read-only scripts to run, so depth 1
is okay I guess.
Anyway, The problem I'm facing is that I'm able to to a sparse checkout with
#############################
##### 1/ configuring local folder
#############################
git init
git config core.sparseCheckout true
#an empty repository with the remote is created:
git remote add -f origin ssh://guillaumedg@domain.com:port/myProjects/thisProject.git
#add repository "e" to be checked out:
echo e/*> .git/info/sparse-checkout
#############################
##### 2/ fetching/updating files
#############################
git fetch
git checkout myBranch
I know I'm close, but what I get is this:
-----A/
|--B/
| |----a/
| |--d/
| |--e/
| |--f/
| |--g.txt
| |--h.readme
|--C/
not this (which is what I want)
-----A/
|--B/
| |--f/
| |--g.txt
| |--h.readme
|--C/
any hints?
by the way I tried different ways of using "depth 1" for "step 2" with no success:
git fetch --depth 1 $(url) $(branch)
git checkout $(branch)
--> error: pathspec 'myBranch' did not match any file(s) known to git.
git fetch --depth 1 $(url) $(branch)
git checkout
--> fatal: You are on a branch yet to be born
git fetch --depth 1 $(url) $(branch)
git checkout -b $(branch)
fatal: A branch named 'myBranch' already exists.
git fetch
git checkout $(branch)
--> works as describe above