Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on How can I make --reset-author the default?

Parent

How can I make --reset-author the default?

+4
−3

I do a lot of rebasing and amending of my topic branches. I don't think it's especially useful for me or my colleagues to see in the logs what date it was when I first started working on the particular topic - only when I actually submitted it.

I know I can explicitly reset the date of my commit to the current time using git commit --amend --reset-author. But is there any way I can change that behaviour to be the default when I rebase or amend, so I don't have to type it every time?

For example: on Monday I put in a new feature and submit the patch for peer review. On Tuesday, my team lead wants me to make some changes to my patch and resubmit. On Wednesday I make the changes, git commit --amend them, and submit the new patch for review. On Thursday the new changes are approved. I pull the master branch and rebase my changes on it.

Right now, that commit entry in my log will still be timestamped Monday, even though I amended on Wednesday and rebased on Thursday. In the future, when we look through the logs, the useful date is when I've finished and push the change (Thursday), not the date of the first commit that no longer exists (Monday). To update the date, now on Thursday, I need to go a git commit --amend --reset-author --no-edit. If I don't do that, it will still say that my change was on a Monday, when it was not.

(Alternatively: am I missing something here? Is it actually useful for people to know that I started work on the topic on Monday, rather than that the change was actually put in on Thursday? Is there a way to see both the datestamp of a commit and the date the commit was actually added to the tree?)

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

General comments (8 comments)
Post
+1
−3

Here's the problem:

Wednesday I make the changes, git commit --amend them

Just do a normal commit. You are trying to re-write, or cover up, history. That's generally bad.

The record should reflect what really happened: You submitted a patch, it was rejected for xxx reason, you changed the patch, it was accepted. You have no way of knowing what part of that might be useful information a month, a year, or years in the future. The cost is tiny. Do it right.

I haven't altered anything that has been pushed

Actually you are. You are changing the comments for the commit.

It seems the overall problem is that your group uses commit comments poorly, and therefore values them less.

I should be able to read all the drafts, right down to the first one, rather than just the final printed edition

Yes. That's rather the basis of source control. Remember also that this is for the people the write the software, not the public that just uses the software.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

1 comment thread

General comments (4 comments)
General comments
Hyperlynx‭ wrote over 3 years ago · edited over 3 years ago

I have no power to change our workflow. Furthermore, I'm not changing history, I haven't altered anything that has been pushed. I'm changing the commits that I'm authoring, before pushing them to the shared repo. This isn't Subversion, where Every Revision Is Sacred. What you're saying is like saying that when I go buy a book I should be able to read all the drafts, right down to the first one, rather than just the final printed edition. https://sandofsky.com/workflow/git-workflow/

Hyperlynx‭ wrote over 3 years ago

It makes it hard to follow the thread of conversation if you're going to reply by editing your answer, rather than not here.

You have misunderstood, or I have expressed myself poorly. I am editing commits which have not been pushed. That's a statement of fact! I am working on a local branch, editing and rebasing to produce a history that is accurate and useful for my team, and only once it passes review is it actually pushed.

Hyperlynx‭ wrote over 3 years ago

As for your value judgement about how we use Git, that's absolutely just your opinion. I could say the same for how you evidently use Git, since you're apparently using it like it's SVN and not getting the full benefit of the tool you have. Read the link I posted. Or don't, since this is irrelevant to what I actually asked anyway.

Hyperlynx‭ wrote over 3 years ago

Besides which, if your attitude is "editing commits is altering history, which is always wrong and is forbidden" then Git probably isn't the tool for you.