-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(core): import should be rebasable #27940
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 4ec79a3. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 4 targets
Sent with 💌 from NxCloud. |
1d523ba
to
53e6358
Compare
53e6358
to
4ec79a3
Compare
spinner.start(`Moving files and git history to ${destinationInSource}`); | ||
|
||
// The result of filter-branch will contain only the files in the subdirectory at its root. | ||
const files = await gitClient.getGitFiles('.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: Moving files is no longer needed since both git filter-repo
and git filter-branch
can handle the move automatically, in a way that allows for rebase.
🐳 We have a release for that!This PR has a release associated with it. You can try it out using this command: npx [email protected] my-workspace Or just copy this version and use it in your own command: 0.0.0-pr-27940-4ec79a3
To request a new release for this pull request, mention someone from the Nx team or the |
// If source and destination are the same, then keep the file as is. | ||
if (src === dest) continue; | ||
const destFile = posix.join(dest, file.replace(srcRegex, '')); | ||
const dir = posix.dirname(destFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: We have to use POSIX here, even on Windows machine.
`Do NOT squash and do NOT rebase these changes when merging these changes.`, | ||
`If you would like to UNDO these changes, run "git reset HEAD~1 --hard"`, | ||
`Do NOT squash these commits when merging these changes.`, | ||
`If you rebase, make sure to use "--rebase-merges" to preserve merge commits.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing github does this under the hood? Hopefully it's the same for other VCS 🤔
When users run `nx import` and open a PR with the imported package, they should be able to use `git rebase --rebase-merges` to update their branch with latest main. ## Why this matters If the repo requires the PR to be updated with latest main before merge, the user must have a way to do this and avoid having to do the import process all over again. <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior Rebase results in git error ## Expected Behavior Rebase works ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes # (cherry picked from commit b921091)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
When users run
nx import
and open a PR with the imported package, they should be able to usegit rebase --rebase-merges
to update their branch with latest main.Why this matters
If the repo requires the PR to be updated with latest main before merge, the user must have a way to do this and avoid having to do the import process all over again.
Current Behavior
Rebase results in git error
Expected Behavior
Rebase works
Related Issue(s)
Fixes #