[Top][All Lists]

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

Re: Git help: amending a substandard commit message in savannah.

From: David Kastrup
Subject: Re: Git help: amending a substandard commit message in savannah.
Date: Mon, 23 Nov 2015 12:32:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

David Caldwell <address@hidden> writes:

> On 11/23/15 2:51 AM, Alan Mackenzie wrote:
>> By the way, what happens to abandoned branches?  Does anybody do a
>> periodic scan of branches to get rid of them?  They surely don't go away
>> of their own accord.  If they aren't garbage collected, then the
>> repository's list of branches will steadily fill up with useless cruft.
> I'm not sure about Savannah, but generally with git you can delete
> remote branches with this syntax:
>    git push origin :branch_to_be_deleted
> If that is allowed, then deleting that branch and then pushing it back
> with your amended change would effectively be the same as `git push -f`.

You glossed over one detail.  The problem is when pushing to an
_existing_ branch, Git uses the existence of the branch to deduce that
you actually want the reference to be refs/heads/branch_to_be_deleted .
So you can use

    git push origin :branch_to_be_deleted

in order to delete the branch, but once it is gone, you need to do

    git push origin HEAD:refs/heads/branch_to_be_deleted

in order to recreate it (after which it is again possible to refer to it
using just branch_to_be_deleted).  So in order to avoid typos, it's
better to delete it with

    git push origin :refs/heads/branch_to_be_deleted

which sort-of makes sure that you are recreating the same branch when
editing the command line in order to insert HEAD or whatever.

Because a reference actually called branch_to_be_deleted (without
starting refs/heads/) is a nuisance to get rid of again and is not
recognized as a branch by branch-specific commands.

David Kastrup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]