Re: why is git destructive by default? (i suggest it not be!)
- From
Theodore Tso <tytso@mit.edu>
- Date
- Jun 24, 2008, 22:54 UTC
- Message-ID
- <20080624225442.GA20361@mit.edu>
- In-Reply-To
- <FmVFerrNVumRho9GZZwRiHrXV_hb12J_P_hSYUBnFhcCFiMGdtdCrg@cipher.nrlssc.navy.mil>
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