All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Alexander GQ Gerasiov <gq@cs.msu.su>, git@vger.kernel.org
Subject: Re: How to put tree into index
Date: Wed, 20 Nov 2013 13:41:10 +0100	[thread overview]
Message-ID: <528CADE6.3020604@viscovery.net> (raw)
In-Reply-To: <20131120154714.39fc5202@snail>

Am 11/20/2013 12:47, schrieb Alexander GQ Gerasiov:
> 1. I have repository with tree like this:
> 
> dir1/
> 	file1
> 	file2
> 	file3
> 
> dir2/
> 	subdir1/
> 		some files
> 
> 
> 2. Current branch is B.
> 
> 3. I want to get dir1 from branch A, and save it's content on current
> branch (B) as dir2/subdir1

> So my question is
> How to put into index tree-object with known sha1 and given name?

git rm -r --cached dir2/subdir1 &&
git read-tree --prefix=dir2/subdir1/ A:dir1

Note the trailing slash.

> PS I was able to do what I need when copied files, not tree-itself.
> Just add -r to git ls-tree, and put into index blobs/files, not tree.
> But I'm interested: is it possible to put tree-object into index?

No, because the index does not store trees, only blobs.

-- Hannes

      parent reply	other threads:[~2013-11-20 12:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-20 11:47 How to put tree into index Alexander GQ Gerasiov
2013-11-20 12:25 ` Matthew Cengia
2013-11-20 12:41 ` Johannes Sixt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528CADE6.3020604@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=git@vger.kernel.org \
    --cc=gq@cs.msu.su \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.