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

Create actual merge conflicts on template sync #175

Open
grst opened this issue Apr 27, 2023 · 3 comments
Open

Create actual merge conflicts on template sync #175

grst opened this issue Apr 27, 2023 · 3 comments

Comments

@grst
Copy link
Collaborator

grst commented Apr 27, 2023

Currently, if there are merge conflicts, cruft either creates .rej files or some inline merge markers (>>>>>>>).

Both are hard to overlook, in particular if pre-commit CI is not activated in one of the repos.

It would be better if the conflicts showed up as actual conflicts in GitHub, such that they can be resolved directly in the web interface.

@grst
Copy link
Collaborator Author

grst commented Jul 13, 2023

It doesn't seem easy. Cruft already merges the files and I don't think it's possible to trick git into believing there are conflicts.
Only now I appreciate how genious the nf-core solution is to have the TEMPLATE branch from the beginning on.

When simply regenerating the template onto a new --orphan branch, github refuses to merge them because they have unrelated histories (using command-line git this actually works by using `--allow-unrelated-histories). Maybe a branch derived from the initial commit of the repo would work 🤔

@grst
Copy link
Collaborator Author

grst commented Nov 28, 2023

@flying-sheep fyi

@grst
Copy link
Collaborator Author

grst commented Feb 25, 2025

I just tried the following and it kind of works:

  • create a new branch off the initial commit of the repo (ideally that commit is the repo as initialized with cruft) (git checkout XXX && git switch -c template-update)
  • remove everything from that branch (find . -not -path "./.git*" -delete)
  • initialize a fresh copy of the cookiecutter template in a different directory (using the same .cruft.json)
  • move over the contents from the new directory into the emptied git repo (rsync -Pva --exclude .git TEMPLATE/<repo>/ <repo>/)
  • git add -A && git commit --no-verify -m "template update"
  • gh pr create
  • enjoy the merge conflicts

We could keep around the template-update branch in the scverse-bot fork. Then creating the template-update branch would be skipped and we'd create a commit that only represents the changes since the last template update. This should make future template updates less invasive.

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

No branches or pull requests

1 participant