Re: Self-inflicted "abort" in a newbie attempt at read-only exploration of a cloned repository?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 5, 2018 at 12:42 PM, Thierry Moreau
<thierry.moreau@xxxxxxxxxxxxx> wrote:
> Dear GIT enthusiasts!
>
> This ends up with a "git checkout" command aborting. A bit frustrating at
> the early stage of GIT learning curve.
>
> My first goal is to clone repositories locally in order to explore the
> various linux kernel versions, with the rich GIT metadata.
>
> Thus, I clone:
>
> $  git clone --branch linux-4.16.y
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
> linux-stable
> $  git -C linux-stable/ branch
> * linux-4.16.y
>
> So far so good. Then, I want to extract an earlier kernel version into a tmp
> dir:
>
> $  mkdir tmp
> $  git -C linux-stable/ --work-tree $PWD/tmp/ checkout linux-4.15.y
> $  git -C linux-stable/ branch
> * linux-4.15.y
>   linux-4.16.y

The documentation for --work-tree says:

--work-tree=<path>

Set the path to the working tree. It can be an absolute path or a path
relative to the current working directory. This can also be controlled
by setting the GIT_WORK_TREE environment variable and the
core.worktree configuration variable (see core.worktree in
git-config(1) for a more detailed discussion).

So passing --work-tree tells Git where to store your _files_, but it's
still using the same .git directory.

If your goal is to have worktrees for various versions, that implies
the git worktree [1] command might be more along the lines of what
you're looking for. An invocation based on above might look like this:
$ git -C linux-stable/ worktree add $PWD/tmp/ checkout linux-4.15.y

That should leave linux-4.16.y checked out in linux-stable, while
creating a full work tree in $PWD/tmp that has 4.15.y checked out.

Note that worktree is a newer git command. 2.17 has it, but old
versions like 2.1 won't.

[1] https://git-scm.com/docs/git-worktree

Hope this helps!
Bryan



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux