Re: why is git destructive by default? (i suggest it not be!)
- Date: Tue, 24 Jun 2008 18:54:42 -0400
- From: Theodore Tso <tytso@xxxxxxx>
- Subject: Re: why is git destructive by default? (i suggest it not be!)
On Tue, Jun 24, 2008 at 04:42:49PM -0500, Brandon Casey wrote:
> Again, as I mentioned to Boaz, there is really no benefit to reusing
> a single branch name if that is what you are trying to do. The cost
> of branching in git is 41 bytes i.e. nil.
The main reason that I find for reusing a branch name is for my
integration branch. I have a script which basically does:
git checkout integration
git reset --hard origin
git merge branch-A
git merge branch-B
git merge branch-C
git merge branch-D
I suppose I could have avoided the use of git reset with something
like this:
git update-index --refresh --unmerged > /dev/null
if git diff-index --name-only HEAD | read dummy; then
echo "There are local changes; refusing to build integration branch!"
exit 1
fi
git update-ref refs/heads/integration origin
git checkout integration
git merge branch-A
git merge branch-B
git merge branch-C
git merge branch-D
Instead, I've just learned to be careful and my use of git reset
--hard is mainly for historical reasons. But the point is, I can very
easily think of workflows where it makes sense to reuse a branch name,
most of them having to do with creating integration branches which are
basically throwaways after I am done testing or building that combined
tree.
- Ted
--
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