# [PATCH] branch: say "Reset to" in reflog entries for 'git branch -f' operations

6 messages from 2010-04-09 to 2010-04-09. Participants: Tay Ray Chuan, Michael J Gruber, Matthieu Moy, Johannes Sixt.
Thread: https://gitlist.dev/t/23389

## Tay Ray Chuan, 2010-04-09 07:45

Subject: [PATCH] branch: say "Reset to" in reflog entries for 'git branch -f' operations
Message-ID: <1270799112-4308-1-git-send-email-rctay89@gmail.com>
URL: https://gitlist.dev/e/1270799112-4308-1-git-send-email-rctay89%40gmail.com

```
In 5f856dd (fix reflog entries for "git-branch"), it is mentioned that
'git branch -f' is intended to be equivalent to 'git reset'. Since we
usually say "reset to <commit>" in the git-reset Documentation and
elsewhere, it would make sense to say "Reset to" here as well.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---

  I happened to be perusing my branch's reflog when I spotted this.

 branch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/branch.c b/branch.c
index 9e1f63e..2ab42aa 100644
--- a/branch.c
+++ b/branch.c
@@ -198,7 +198,7 @@ void create_branch(const char *head,
 		log_all_ref_updates = 1;

 	if (forcing)
-		snprintf(msg, sizeof msg, "branch: Reset from %s",
+		snprintf(msg, sizeof msg, "branch: Reset to %s",
 			 start_name);
 	else if (!dont_change_ref)
 		snprintf(msg, sizeof msg, "branch: Created from %s",
--
1.7.1.rc0.240.gba75f

```

## Michael J Gruber, 2010-04-09 11:55

Subject: Re: [PATCH] branch: say "Reset to" in reflog entries for 'git branch -f' operations
Message-ID: <4BBF159A.1000206@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4BBF159A.1000206%40drmicha.warpmail.net
In-Reply-To: <1270799112-4308-1-git-send-email-rctay89@gmail.com>

```
Tay Ray Chuan venit, vidit, dixit 09.04.2010 15:45:
> In 5f856dd (fix reflog entries for "git-branch"), it is mentioned that
> 'git branch -f' is intended to be equivalent to 'git reset'. Since we
> usually say "reset to <commit>" in the git-reset Documentation and
> elsewhere, it would make sense to say "Reset to" here as well.
> 

I know the patch is not large, but one really has to read it after
wondering: Huh? What is branch -f doing now before the patch? To me it
sounded as if it didn't write to the reflog at all. So, how about

elsewhere, it would make sense to say "Reset to" here as well rather
than "Rest from".

But I also have a functional question: Is "start_from" really the ref
*to* which the branch is reset? I hope reset does it right.

> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
> ---
> 
>   I happened to be perusing my branch's reflog when I spotted this.
> 
>  branch.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/branch.c b/branch.c
> index 9e1f63e..2ab42aa 100644
> --- a/branch.c
> +++ b/branch.c
> @@ -198,7 +198,7 @@ void create_branch(const char *head,
>  		log_all_ref_updates = 1;
> 
>  	if (forcing)
> -		snprintf(msg, sizeof msg, "branch: Reset from %s",
> +		snprintf(msg, sizeof msg, "branch: Reset to %s",
>  			 start_name);
>  	else if (!dont_change_ref)
>  		snprintf(msg, sizeof msg, "branch: Created from %s",
> --
> 1.7.1.rc0.240.gba75f
> 

```

## Matthieu Moy, 2010-04-09 12:03

Subject: Re: [PATCH] branch: say "Reset to" in reflog entries for 'git branch -f' operations
Message-ID: <vpqk4sgltoh.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqk4sgltoh.fsf%40bauges.imag.fr
In-Reply-To: <4BBF159A.1000206@drmicha.warpmail.net>

```
Michael J Gruber <git@drmicha.warpmail.net> writes:

> But I also have a functional question: Is "start_from" really the ref
> *to* which the branch is reset? I hope reset does it right.

I don't know which is which, but if start_from is the destination of
the ref, then it should be renamed. I don't think we want to have this

		snprintf(msg, sizeof msg, "branch: Reset to %s",
                                                         ^^
 			 start_name);
                         ^^^^^

in the code.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```

## Tay Ray Chuan, 2010-04-09 12:18

Subject: Re: [PATCH] branch: say "Reset to" in reflog entries for 'git branch -f' operations
Message-ID: <w2nbe6fef0d1004090518hee66e33esd93e767580837b55@mail.gmail.com>
URL: https://gitlist.dev/e/w2nbe6fef0d1004090518hee66e33esd93e767580837b55%40mail.gmail.com
In-Reply-To: <4BBF159A.1000206@drmicha.warpmail.net>

```
Hi,

On Fri, Apr 9, 2010 at 7:55 PM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> I know the patch is not large, but one really has to read it after
> wondering: Huh? What is branch -f doing now before the patch? To me it
> sounded as if it didn't write to the reflog at all. So, how about
>
> elsewhere, it would make sense to say "Reset to" here as well rather
> than "Rest from".

Sounds good.

> But I also have a functional question: Is "start_from" really the ref
> *to* which the branch is reset? I hope reset does it right.

(I think you mean "start_name" instead of "start_from".)

Well, "start_name" determines where the branch/ref points to. I don't
think any branch can "start", except that it can diverge.

But that's outside the scope of this patch.

-- 
Cheers,
Ray Chuan

```

## Johannes Sixt, 2010-04-09 12:20

Subject: Re: [PATCH] branch: say "Reset to" in reflog entries for 'git branch -f' operations
Message-ID: <4BBF1B80.8050307@viscovery.net>
URL: https://gitlist.dev/e/4BBF1B80.8050307%40viscovery.net
In-Reply-To: <vpqk4sgltoh.fsf@bauges.imag.fr>

```
Am 4/9/2010 14:03, schrieb Matthieu Moy:
> Michael J Gruber <git@drmicha.warpmail.net> writes:
> 
>> But I also have a functional question: Is "start_from" really the ref
>> *to* which the branch is reset? I hope reset does it right.
> 
> I don't know which is which, but if start_from is the destination of
> the ref, then it should be renamed. I don't think we want to have this
> 
> 		snprintf(msg, sizeof msg, "branch: Reset to %s",
>                                                          ^^
>  			 start_name);
>                          ^^^^^
> 
> in the code.

I think the patch is right.

The "start" part refers to where the branch forks off of existing history.

In the case were an existing branch is pointed to a new commit, the "Reset
to" is indeed correct. IIUC, the "start_name" is what was given on the
command line as fork point (or HEAD if not given). For example, after

   git branch -f thebranch master~23

the reflog of 'thebranch' would now read as "Reset to master~23".

-- Hannes

```

## Tay Ray Chuan, 2010-04-09 12:38

Subject: [PATCH v2] branch: say "Reset to" in reflog entries for 'git branch -f' operations
Message-ID: <1270816698-3464-1-git-send-email-rctay89@gmail.com>
URL: https://gitlist.dev/e/1270816698-3464-1-git-send-email-rctay89%40gmail.com
In-Reply-To: <1270799112-4308-1-git-send-email-rctay89@gmail.com>

```
In 5f856dd (fix reflog entries for "git-branch"), it is mentioned that
'git branch -f' is intended to be equivalent to 'git reset'. Since we
usually say "reset to <commit>" in the git-reset Documentation and
elsewhere, it would make sense to say "Reset to" here as well, instead
of "Reset from" previously.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
---

Changed from v1:
 - Mention old reflog message in patch message, as suggested by
   Michael J Gruber.

 branch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/branch.c b/branch.c
index 9e1f63e..2ab42aa 100644
--- a/branch.c
+++ b/branch.c
@@ -198,7 +198,7 @@ void create_branch(const char *head,
 		log_all_ref_updates = 1;

 	if (forcing)
-		snprintf(msg, sizeof msg, "branch: Reset from %s",
+		snprintf(msg, sizeof msg, "branch: Reset to %s",
 			 start_name);
 	else if (!dont_change_ref)
 		snprintf(msg, sizeof msg, "branch: Created from %s",
--
1.7.1.rc0.240.gba75f

```
