Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't modify commits on rebase #1452

Open
mattwynne opened this issue Jul 19, 2024 · 6 comments
Open

Don't modify commits on rebase #1452

mattwynne opened this issue Jul 19, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@mattwynne
Copy link

Is your feature request related to a problem? Please describe.
I've noticed that if I'm working in a branch and I rebase from main, all the commits in the branch end up with the current set of configured co-authors on them. So the original co-author info in the branch is lost.

Describe the solution you'd like
When doing a rebase, don't modify the co-author trailer on the rebased commits.

Describe alternatives you've considered
Live with it? :)

@mattwynne mattwynne added the enhancement New feature or request label Jul 19, 2024
@PurpleBooth
Copy link
Owner

ooh that's a tricky one, seems annoying though. I will have a look (also open to PRs if you feel comfortable with that)

@PurpleBooth
Copy link
Owner

What would you expect, the rebaser to be represented in the trailers, but added to the existing ones, to appear as "the committer" or just make no change?

@mattwynne
Copy link
Author

mattwynne commented Jul 22, 2024 via email

@PurpleBooth
Copy link
Owner

PurpleBooth commented Jul 23, 2024

This is the behaviour I am going to add, seem sensible? I'll do it as opt in then push a change to make it the default with a major bump

Rebases

It might be preferable not to do this on rebase, you can disable this happening on rebase by running

git mit-config mit rebase-behaviour no-change

lets say we have two diverging branches

echo "Lorem Ipsum" >> new-so-no-conflicts.md
git switch -c rebase-demo-branch
git switch -
git commit --all --message="Diverging commit" --quiet
git switch -

Now you can rebase changes without adding any additional trailers

git mit bt se
echo "Lorem Ipsum" >> README.md

git commit --all --message="Rebase behaviour
" --quiet
git show --pretty='format:author: [%an %ae] signed-by: [%GS] 
---
%B' -q
author: [Billie Thompson billie@example.com] signed-by: [] 
---
Rebase behaviour

Co-authored-by: Someone Else <se@example.com>

Then if you rebase the commit stays the same

git mit bt ae
git rebase --reset-author-date "-"
ls .git
echo ----
cat .git/AUTO_MERGE
echo ----
cat .git/HEAD
echo ----
cat .git/ORIG_HEAD
echo ----
git show --pretty='format:author: [%an %ae] signed-by: [%GS] 
---
%B' -q
author: [Billie Thompson billie@example.com] signed-by: [] 
---
Rebase behaviour

Co-authored-by: Someone Else <se@example.com>

The default setting is to modify the co-authored by.

git mit-config mit rebase-behaviour add-to

Now you can rebase changes without adding any additional trailers

git mit bt se
git rebase --reset-author-date "-"
git show --pretty='format:author: [%an %ae] signed-by: [%GS] 
---
%B' -q
author: [Billie Thompson billie@example.com] signed-by: [] 
---
Rebase behaviour

Co-authored-by: Someone Else <se@example.com>
Co-authored-by: Anyone Else <anyone@example.com>

@mattwynne
Copy link
Author

mattwynne commented Jul 23, 2024 via email

@PurpleBooth
Copy link
Owner

This should be out now, not defaulted yet.

git mit-config mit set-non-clean-behaviour no-change

to turn it on

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants