* Git help: amending a substandard commit message in savannah.
@ 2015-11-23 10:51 Alan Mackenzie
2015-11-23 11:01 ` David Caldwell
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Alan Mackenzie @ 2015-11-23 10:51 UTC (permalink / raw)
To: emacs-devel
Hello, Emacs.
Yesterday, I committed a fix to savannah on "my own" branch
fix/not-defined-at-runtime. The commit message was poorly constructed.
I have corrected this locally with
git commit --amend
. When I attempt to push this to savannah with
git push --force
, my attempt quite properly gets rejected with an error message.
Is there any way I can get this correction onto this branch (e.g. does
anybody have the necessary permissions to perform the git push --force),
or would I be better just to abandon the branch and create another one?
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.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
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
2015-11-23 11:10 ` Artur Malabarba
2015-11-23 16:21 ` Eli Zaretskii
2 siblings, 1 reply; 12+ messages in thread
From: David Caldwell @ 2015-11-23 11:01 UTC (permalink / raw)
To: Alan Mackenzie, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
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`.
-David
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
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:10 ` Artur Malabarba
2015-11-23 16:21 ` Eli Zaretskii
2 siblings, 0 replies; 12+ messages in thread
From: Artur Malabarba @ 2015-11-23 11:10 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> . When I attempt to push this to savannah with
>
> git push --force
>
> , my attempt quite properly gets rejected with an error message.
Are you sure that message wasn't because you inadvertently tried force
pushing to master? I think older git versions default to pushing
everything if you don't specify branches.
I'm asking this because I'm relatively certain I've force pushed to
scratch branches in the past without issues.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 11:01 ` David Caldwell
@ 2015-11-23 11:32 ` David Kastrup
2015-11-23 12:38 ` Yuri Khan
2015-11-23 19:31 ` David Caldwell
0 siblings, 2 replies; 12+ messages in thread
From: David Kastrup @ 2015-11-23 11:32 UTC (permalink / raw)
To: David Caldwell; +Cc: Alan Mackenzie, emacs-devel
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 11:32 ` David Kastrup
@ 2015-11-23 12:38 ` Yuri Khan
2015-11-23 19:31 ` David Caldwell
1 sibling, 0 replies; 12+ messages in thread
From: Yuri Khan @ 2015-11-23 12:38 UTC (permalink / raw)
Cc: Alan Mackenzie, Emacs developers, David Caldwell
On Mon, Nov 23, 2015 at 5:32 PM, David Kastrup <dak@gnu.org> wrote:
> 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
Not necessarily. You can say
git push origin my_branch
and it will be pushed to origin as refs/heads/my_branch.
Also, my quick experiment shows that all these commands create
branches in the origin under refs/heads/:
git push origin my_branch
git push origin my_branch:other_branch
git push origin HEAD:more_branch
Can this be a Git version difference? I’m on 2.6.3.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
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:10 ` Artur Malabarba
@ 2015-11-23 16:21 ` Eli Zaretskii
2015-11-23 16:27 ` Alan Mackenzie
2015-11-23 16:42 ` John Yates
2 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2015-11-23 16:21 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> Date: Mon, 23 Nov 2015 10:51:52 +0000
> From: Alan Mackenzie <acm@muc.de>
>
> I have corrected this locally with
>
> git commit --amend
>
> . When I attempt to push this to savannah with
>
> git push --force
>
> , my attempt quite properly gets rejected with an error message.
>
> Is there any way I can get this correction onto this branch (e.g. does
> anybody have the necessary permissions to perform the git push --force),
Only Savannah admins can do that.
> or would I be better just to abandon the branch and create another one?
You shouldn't worry about this at all, since you will get a second
chance when you merge/rebase this branch onto master. Be sure to
double-check your log message at that time before you push, and Bob's
your uncle.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 16:21 ` Eli Zaretskii
@ 2015-11-23 16:27 ` Alan Mackenzie
2015-11-23 16:42 ` John Yates
1 sibling, 0 replies; 12+ messages in thread
From: Alan Mackenzie @ 2015-11-23 16:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: emacs-devel
Hello, Eli.
On Mon, Nov 23, 2015 at 06:21:12PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 23 Nov 2015 10:51:52 +0000
> > From: Alan Mackenzie <acm@muc.de>
> >
> > I have corrected this locally with
> >
> > git commit --amend
> >
> > . When I attempt to push this to savannah with
> >
> > git push --force
> >
> > , my attempt quite properly gets rejected with an error message.
> >
> > Is there any way I can get this correction onto this branch (e.g. does
> > anybody have the necessary permissions to perform the git push --force),
> Only Savannah admins can do that.
Which makes sense.
> > or would I be better just to abandon the branch and create another one?
> You shouldn't worry about this at all, since you will get a second
> chance when you merge/rebase this branch onto master. Be sure to
> double-check your log message at that time before you push, and Bob's
> your uncle.
Ah. Thanks a lot for this! So when the time comes I'll be careful
about these messages.
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
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
1 sibling, 1 reply; 12+ messages in thread
From: John Yates @ 2015-11-23 16:42 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Alan Mackenzie, Emacs developers
[-- Attachment #1: Type: text/plain, Size: 528 bytes --]
> From: Alan Mackenzie <acm@muc.de>
> or would I be better just to abandon the branch and create another one?
My understanding is that if you never merge that tip with its sub-par
commit message into master then ultimately it will time out and get garbage
collected. You could create a new branch just before the one you wish to
amend and push that new branch to Savannah. (Under the covers that is more
or less what git amend does.) From then on you would work on that new
branch, ultimately merging it into master.
/john
[-- Attachment #2: Type: text/html, Size: 641 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 16:42 ` John Yates
@ 2015-11-23 17:49 ` Alan Mackenzie
2015-11-23 18:31 ` David Kastrup
0 siblings, 1 reply; 12+ messages in thread
From: Alan Mackenzie @ 2015-11-23 17:49 UTC (permalink / raw)
To: John Yates; +Cc: Eli Zaretskii, Emacs developers
Hello, John
On Mon, Nov 23, 2015 at 11:42:49AM -0500, John Yates wrote:
> > From: Alan Mackenzie <acm@muc.de>
> > or would I be better just to abandon the branch and create another one?
> My understanding is that if you never merge that tip with its sub-par
> commit message into master then ultimately it will time out and get
> garbage collected. You could create a new branch just before the one
> you wish to amend and push that new branch to Savannah. (Under the
> covers that is more or less what git amend does.) From then on you
> would work on that new branch, ultimately merging it into master.
Presumably the timeout period is some system-wide setting, and it will
be something like 3 months.
> /john
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 17:49 ` Alan Mackenzie
@ 2015-11-23 18:31 ` David Kastrup
0 siblings, 0 replies; 12+ messages in thread
From: David Kastrup @ 2015-11-23 18:31 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: Eli Zaretskii, Emacs developers, John Yates
Alan Mackenzie <acm@muc.de> writes:
> Hello, John
>
> On Mon, Nov 23, 2015 at 11:42:49AM -0500, John Yates wrote:
>> > From: Alan Mackenzie <acm@muc.de>
>> > or would I be better just to abandon the branch and create another one?
>
>> My understanding is that if you never merge that tip with its sub-par
>> commit message into master then ultimately it will time out and get
>> garbage collected. You could create a new branch just before the one
>> you wish to amend and push that new branch to Savannah. (Under the
>> covers that is more or less what git amend does.) From then on you
>> would work on that new branch, ultimately merging it into master.
>
> Presumably the timeout period is some system-wide setting, and it will
> be something like 3 months.
You can _delete_ the branch and push a "new" branch with the same name
right away.
I do that frequently for temporary branches in a repository that does
not allow forced rewrites.
The timeouts are for cleaning out commits that are no longer referenced
in a branch or tag. Those commits remain accessible by commit id in the
repository for three months before they are cleaned out when they are
not accessible through a symbolic reference like an actual branch or
tag.
--
David Kastrup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 11:32 ` David Kastrup
2015-11-23 12:38 ` Yuri Khan
@ 2015-11-23 19:31 ` David Caldwell
2015-11-23 20:17 ` David Kastrup
1 sibling, 1 reply; 12+ messages in thread
From: David Caldwell @ 2015-11-23 19:31 UTC (permalink / raw)
To: David Kastrup; +Cc: Alan Mackenzie, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]
On 11/23/15 3:32 AM, David Kastrup wrote:
> 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).
Er, what? That's not right. Once you've deleted a branch on the remote
git server you can just push it back using whatever command you created
it with in the first place. Of course the commands you gave will work,
but it's over-complicating things certainly not required. You can do
this all day:
git push origin :branch_to_be_deleted
git push origin branch_to_be_deleted
git push origin :branch_to_be_deleted
git push origin branch_to_be_deleted
git push origin :branch_to_be_deleted
git push origin branch_to_be_deleted
…etc.
It's easy enough to test:
cd /tmp
mkdir test
cd test
mkdir a
cd a
git init
echo a > a
git add a
git commit -m a
cd ..
git clone a b
cd b
git checkout -b mybranch
echo b > b
git add b
git commit -m b
git push origin mybranch
git push origin :mybranch
git push origin mybranch
git push origin :mybranch
git push origin mybranch
-David
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4239 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Git help: amending a substandard commit message in savannah.
2015-11-23 19:31 ` David Caldwell
@ 2015-11-23 20:17 ` David Kastrup
0 siblings, 0 replies; 12+ messages in thread
From: David Kastrup @ 2015-11-23 20:17 UTC (permalink / raw)
To: David Caldwell; +Cc: Alan Mackenzie, emacs-devel
David Caldwell <david@porkrind.org> writes:
> On 11/23/15 3:32 AM, David Kastrup wrote:
>
>> 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).
>
> Er, what? That's not right. Once you've deleted a branch on the remote
> git server you can just push it back using whatever command you created
> it with in the first place. Of course the commands you gave will work,
> but it's over-complicating things certainly not required. You can do
> this all day:
>
> git push origin :branch_to_be_deleted
> git push origin branch_to_be_deleted
_Iff_ the reference you push has the name branch_to_be_deleted in the
first place. If you name the reference explicitly, namely if your
pushing command contains a : sign, then you need the full reference name
on the right side of the :. If you only name one reference, then the
disambiguation used for finding the reference in the local repository
will be pushed to the remote side.
Try
git push origin HEAD:branch_to_be_deleted
to see what I mean. Or even
git push origin branch_to_be_deleted:branch_to_be_deleted
--
David Kastrup
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-11-23 20:17 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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.