Re: How to start well for a special git construction

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

 



On Fri, Mar 19, 2010 at 4:30 PM, bruno le hyaric
<bruno.lehyaric@xxxxxxxxx> wrote:
> Thanks for your help.
> I've just created my empty new branch for delivery stuff... and
> effectively the branch is empty :-D
> Any idea on how I can add executable files in this empty branch from
> the master branch? Is that possible?
> (perhaps I'm using Git in a bad way)

There are fancy things you can do to create a branch containing only a
single file without checking it out.  It's a bit advanced, but it
looks something like this:

    FILENAME=path/to/file
    BASENAME=$(basename $FILENAME)
    BLOBID=$(cat $FILENAME | git hash-object --stdin -w)
    TREEID=$(printf '100644 blob %s\t%s' $BLOBID $BASENAME | git mktree)
    COMMITID=$(echo Commit Message | git commit-tree $TREEID -p
refs/heads/release-branch)
    git update-ref refs/heads/release-branch $COMMITID

A more straightforward way to do it would be to clone your repository,
and check out the release branch in your clone, then copy the file to
it and commit as you normally would.

Have fun,

Avery
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]