threads / discuss / 62627

Git pull --rebase and --reset-author-date

Subject: Git pull --rebase and --reset-author-date

## tl;dr

4 messages between Dec 11, 2024 and Dec 13, 2024.

replies: 3people: 2as markdown or json

Ricardo Almeida· Dec 11, 2024, 20:55 UTC · lore
Hi,

I just learned about being able to use "git rebase master --reset-author-date" to, as the name implies, reset the author date of the branch commits that will move to the top.

But, when working in a branch, I use "git pull origin --rebase --stat master:master" to update the master branch and rebase the current branch with a single command (have it in an alias, to avoid typing it all). So, I tried to execute "git pull origin --rebase --reset-author-date --stat master:master" but it's not possible :(

error: unknown option `reset-author-date'

So, I was wondering if there's a similar option that can be used with git pull --rebase or if I can request this feature to be added? :)

Regards, Ricardo Almeida

Junio C Hamano· Dec 12, 2024, 03:16 UTC · re: Ricardo Almeida · lore

Re: Git pull --rebase and --reset-author-date

Ricardo Almeida <ric.almeida@gmail.com> writes:
Show 5 quoted lines
>
> error: unknown option `reset-author-date'
>
> So, I was wondering if there's a similar option that can be used with
> git pull --rebase or if I can request this feature to be added? :)

Can't you just use "git fetch && git rebase --..." instead of "pull" short-hand?

Ricardo Almeida· Dec 12, 2024, 08:25 UTC · re: Junio C Hamano · lore

Re: Git pull --rebase and --reset-author-date

Hi Junio,
> Can't you just use "git fetch && git rebase --..." instead of "pull"
> short-hand?

But then it wouldn't update the master branch... When I'm on myBranch and execute "git pull origin --rebase --stat master:master" it does bring the master branch up to date, so, it's equivalent to doing:

git checkout master git pull git checkout myBranch git rebase master

I have an alias for the pull command: "alias.rb=pull origin --rebase --stat master:master", so, it would be handier to just add the --reset-author-date to it but it's not supported atm :(

Regards, Ricardo Almeida

Junio C Hamano· Dec 13, 2024, 03:31 UTC · re: Ricardo Almeida · lore

Re: Git pull --rebase and --reset-author-date

Ricardo Almeida <ric.almeida@gmail.com> writes:
Show 8 quoted lines
> Hi Junio,
>
>> Can't you just use "git fetch && git rebase --..." instead of "pull"
>> short-hand?
>
> But then it wouldn't update the master branch... When I'm on myBranch
> and execute "git pull origin --rebase --stat master:master" it does
> bring the master branch up to date, so...

"git pull origin master:master" is a bit unusal thing to say these days, but the "take their refs/heads/master, and copy it to my refs/heads/master (as long as it results in a fast-forward update and as long as I am not on 'master')" part of it can be reproduced by "git fetch origin master:master". So I do not see what you see as a problem. You are willing to be explicit to say that unusual "directly update my local branch 'master'" from the command line for your "git pull", so I would imagine you are also OK with doing the same with "git fetch" in the replacement.

← back to recent threads