It seems strange to use git (or other VCS) to store build products.

To your question, the simplest approach would be something like this:

git checkout dst
rm -rf *
git checkout src .
<run build process>
git commit

You can get a little more fancy if you want to reference the src branch as
a parent, by replacing the commit with something like the following:

TREE=$(git write-tree) && COMMIT=$(git commit-tree $TREE -p dst -p src -m
"commit message") && git update-ref HEAD $COMMIT && git update-index
--refresh

You could use other plumbing commands to manipulate the state of the index
and working tree as well.

git checkout dst
git read-tree -m -u src
<run build and commit>

... seems to do what you want in one step, but if you just do the read-tree
and have changes, it will merge them.

git checkout dst
git read-tree src
git clean -f
git checkout .
<run build and commit>

may be the cleanest (no pun intended) variant of doing what you request.

Bob


On Tue, May 20, 2014 at 10:22 PM, Sam Roberts <vieuxt...@gmail.com> wrote:

> On Tue, May 20, 2014 at 7:00 PM, Pierre-François CLEMENT
> <lik...@gmail.com> wrote:
> > Okay then, in that case what you need is the --squash option of
> git-merge.
> >
> >> --squash, --no-squash
>
> Interesting idea, but I don't think it will work, since I don't want
> any of  the build products from the last commit
> on the deploy branch.
>
> Imagine master starts with a.c and b.c, then a.c is removed, and d.c is
> added:
>
> master: A (a.c, b.c) -> B(b.c, d.c)
>
> What I want is for a deploy to look like:
>
> deploy: A1 (a.c,b.c) -> A2 (a.c, b.c, a.o, b.o) -> B1 (b.c,d.c) ->
> B2(b.c, d.c, b.o, d.o)
>
> or preferably just:
>
> deploy: A* (a.c, b.c, a.o, b.o) -> B*(b.c, d.c, b.o, d.o)
>
> (above is easy, its just a squash of the pre-built source with the
> post-built source).
>
> If I squash merged B into A*, I think the files ADDed into the deploy
> branch A* would not get removed, I'd have:
>
> bad-deploy: A2 -> B*(b.c, d.c, a.o, b.o)
>
> Where a.o is build file for a source file that doesn't exit anymore.
>
> I don't want anything from the previous commit, and everything from the
> next.
>
> I think I'll read carefully through this:
>
> http://git-scm.com/book/en/Git-Internals-Git-Objects
>
>
> it looks like I made be able to read/write commits constructed as I wish.
>
> Sam
>
> Btw, thanks for the suggestions, I appreciate it.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Git for human beings" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to git-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to