Re: How to start well for a special git construction
From: Avery Pennarun <hidden>
Date: 2016-06-15 22:48:27
On Fri, Mar 19, 2010 at 4:30 PM, bruno le hyaric [off-list ref] 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