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

Make this template a remote of user repos to get updates? #106

Open
lindsayplatt opened this issue Feb 27, 2023 · 2 comments
Open

Make this template a remote of user repos to get updates? #106

lindsayplatt opened this issue Feb 27, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@lindsayplatt
Copy link
Contributor

Related to updates and being able to get upstream changes, I know we went back-and-forth on whether this should be a template repo or not because it would disconnect people from upstream changes. I was recently introduced to the idea that your "remote" does not always have to be the exact same code repo when learning about copying a selection of commits/files from one repo into a different, existing and unrelated repo.

I learned in this blog post, that you can copy files from one repo to another AND retain a git history. I think we could use this by having a user setup this template repo as a remote to their pipeline and merge in changes that are made in the template. In our use-case here, we would not do the mkdir or git clone step of the "source" repo part. Instead, we would make a new branch in the existing pipeline repo and then follow along with the git clone just for the "target" repo. It should be able to handle merge conflicts since you are going to merge the branch from the source into your main from the target repo.

It might be fun to test this out and see if this helps us be able to `git pull new changes to the template into repos that have since deviated from the template. I imagine this would be an advanced user's action only, as it doesn't seem super straightforward.

@lindsayplatt lindsayplatt added the enhancement New feature or request label Feb 27, 2023
@lekoenig
Copy link

lekoenig commented Mar 2, 2023

Instead, we would make a new branch in the existing pipeline repo and then follow along with the git clone just for the "target" repo.

Thanks for sharing, @lindsayplatt! I agree that this could be a useful pattern for advanced users. I'm not sure I'm following what steps are needed within this repo to test this out. Would we need to create a new branch in this repo, and if so, why can't a user set their upstream remote to main?

@lindsayplatt
Copy link
Contributor Author

lindsayplatt commented Mar 2, 2023

Sorry, I think I am not being super clear with the terminology I am using. Also, maybe the link above is not as helpful in this case but was the inspiration for me thinking we can connect a template repo with a repo that was created from the template.

  • I think the only changes needed to this repo, ds-pipelines-targets-example-wqp would be instructions in the README or elsewhere with how to setup this sort of workflow for pulling new changes from the template. Though, it would be necessary to test this process out and make sure it works as expected.
  • When you are setting this up in your own repo that was created from the template, let's call it my-pipeline, I think you would do the following inside of the my-pipeline repo:
    1. Set up a remote called upstream-template in order to connect ds-pipelines-targets-example-wqp to my-pipeline (run git add upstream-template [email protected]:USGS-R/ds-pipelines-targets-example-wqp.git)
    2. When there are new changes in the template that you want, pull changes from the upstream-template. I think you could do this by pulling directly into my-pipeline: main branch OR you could create a new branch in my-pipeline and then do a merge request later between the two branches of my-pipeline to track those changes in a PR but could be as easily included in a single commit. The simplest way to do this would be to run the following in my-pipeline: git pull upstream-template main.

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