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

feat(import): Add --preserve-commit #2079

Merged
merged 3 commits into from May 11, 2019

Conversation

chrisdothtml
Copy link
Contributor

@chrisdothtml chrisdothtml commented May 9, 2019

Hopefully this helps to digest the diff:

Description, Motivation, and Context

Direct quote from my update to the README:

Each git commit has an author and a committer (with a separate date for each). Usually they're the same person (and date), but since lerna import re-creates each commit from the external repository, the committer becomes the current git user (and date). This is technically correct, but may be undesireable, for example, on Github, which displays both the author and committer if they're different people, leading to potentially confusing history/blames on imported commits.

Enabling this option preserves the original committer (and commit date) to avoid such issues.

The way it achieves this is by:

  1. configuring to the original git user.name and user.email before applying each commit, and
  2. passing --committer-date-is-author-date into git am

EDIT: a bit more context — I recently was combining 30+ repos into a new monorepo, which ended up being over 4,000 commits. Upon pushing to github, this would have exploded my github activity and included me in the blame for the entire history of all the repos, which was undesirable for obvious reasons. I ended up hacking this change in my node_modules to get the imports I wanted, but figured I'd contribute it upstream in case anyone else found it valuable.

How Has This Been Tested?

Added tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@evocateur evocateur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@evocateur evocateur merged commit 6a7448d into lerna:master May 11, 2019
@chrisdothtml chrisdothtml deleted the preserve-commit branch May 11, 2019 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants