From: David Kastrup <dak@gnu.org>
To: David Caldwell <david@porkrind.org>
Cc: Alan Mackenzie <acm@muc.de>, emacs-devel@gnu.org
Subject: Re: Git help: amending a substandard commit message in savannah.
Date: Mon, 23 Nov 2015 12:32:36 +0100 [thread overview]
Message-ID: <871tbh6je3.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <5652F1EE.2080104@porkrind.org> (David Caldwell's message of "Mon, 23 Nov 2015 03:01:02 -0800")
David Caldwell <david@porkrind.org> 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
next prev parent reply other threads:[~2015-11-23 11:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 10:51 Git help: amending a substandard commit message in savannah Alan Mackenzie
2015-11-23 11:01 ` David Caldwell
2015-11-23 11:32 ` David Kastrup [this message]
2015-11-23 12:38 ` Yuri Khan
2015-11-23 19:31 ` David Caldwell
2015-11-23 20:17 ` David Kastrup
2015-11-23 11:10 ` Artur Malabarba
2015-11-23 16:21 ` Eli Zaretskii
2015-11-23 16:27 ` Alan Mackenzie
2015-11-23 16:42 ` John Yates
2015-11-23 17:49 ` Alan Mackenzie
2015-11-23 18:31 ` David Kastrup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871tbh6je3.fsf@fencepost.gnu.org \
--to=dak@gnu.org \
--cc=acm@muc.de \
--cc=david@porkrind.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.