From 5bf8cc12b4c1b4ca2953ec2401cded84ab533b46 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Tue, 19 Dec 2023 17:13:54 +0000 Subject: [PATCH 1/9] add rebase how-to steps and one per branch steps for how to rebase in local and remote repositories --- CONTRIBUTING.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15164da1..5b4e7abd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -94,6 +94,7 @@ install.packages(c("sandpaper", "varnish", "pegboard", "tinkr"), To contribute with a new episode: - [Create](https://happygitwithr.com/git-branches#create-a-new-branch) a new feature branch. Write in there your contribution. +- Create an Issue to report the start of your WIP feature branch. Add the [WIP label](https://github.com/epiverse-trace/tutorials/labels/WIP) to it. This aims to keep one contributor per feature branch. - [Create](https://carpentries.github.io/sandpaper-docs/aio.html#episodes) a new episode with `sandpaper::create_episode_md("Episode Name")` If you need to work with the most recent versions of packages: @@ -121,9 +122,15 @@ To merge your new episodes: - Make a Pull request (PR). You can follow the stesp on [using GitHub](#using-github). - Keep branches up to date with `main`. - This encourage to keep the history as linear as possible, prioritizing actions like ["rebase and merge"](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge) to accept the PR. - - Do this in your local repository only. In your feature branch: - - Go to the terminal. [Run `git pull origin main`](https://docs.gitlab.com/ee/topics/git/git_rebase.html) to rebase the feature branch. - - Go to Git tab in the environments pane. Click on `Pull options` > `Pull with rebase`. + - In the local repository: + - Switch to the `main` branch: `git checkout main` + - Pull the `main` branch: `git pull` + - Switch to your `feature` branch: `git checkout feature` + - [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch: `git rebase main` + - Push your rebased `featured` branch using the `--force` (this must be a forced update): `git push --force` + - In the remote repository, i.e. on GitHub, only if you are in a PR: + - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). + #### Reviewer: From 08192f7d505ec3cae1cc604fc89c269693d2d253 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Tue, 19 Dec 2023 17:29:58 +0000 Subject: [PATCH 2/9] add that rebase is done onto main branch --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b4e7abd..44e402e5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,7 +126,7 @@ To merge your new episodes: - Switch to the `main` branch: `git checkout main` - Pull the `main` branch: `git pull` - Switch to your `feature` branch: `git checkout feature` - - [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch: `git rebase main` + - [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` - Push your rebased `featured` branch using the `--force` (this must be a forced update): `git push --force` - In the remote repository, i.e. on GitHub, only if you are in a PR: - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). From c18672e2a9abcf5d07b93924ac8cdda17ab424cd Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Tue, 19 Dec 2023 17:33:21 +0000 Subject: [PATCH 3/9] add option to --force --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 44e402e5..4977ae37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -127,7 +127,7 @@ To merge your new episodes: - Pull the `main` branch: `git pull` - Switch to your `feature` branch: `git checkout feature` - [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` - - Push your rebased `featured` branch using the `--force` (this must be a forced update): `git push --force` + - Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` - In the remote repository, i.e. on GitHub, only if you are in a PR: - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). From 1998fd07fc869fceef11bc243add6c2593054981 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Tue, 19 Dec 2023 17:53:24 +0000 Subject: [PATCH 4/9] specify that dev must follow all five steps --- CONTRIBUTING.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4977ae37..419c19c4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,12 +122,12 @@ To merge your new episodes: - Make a Pull request (PR). You can follow the stesp on [using GitHub](#using-github). - Keep branches up to date with `main`. - This encourage to keep the history as linear as possible, prioritizing actions like ["rebase and merge"](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge) to accept the PR. - - In the local repository: - - Switch to the `main` branch: `git checkout main` - - Pull the `main` branch: `git pull` - - Switch to your `feature` branch: `git checkout feature` - - [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` - - Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` + - In the local repository, follow all these five steps: + 1. Switch to the `main` branch: `git checkout main` + 2. Pull the `main` branch: `git pull` + 3. Switch to your `feature` branch: `git checkout feature` + 4. [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` + 5. Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` - In the remote repository, i.e. on GitHub, only if you are in a PR: - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). From 9df13a4ced0584c166f2603d2d8a8d19bd523a47 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Tue, 19 Dec 2023 18:00:01 +0000 Subject: [PATCH 5/9] add warning to do rebase only for one contributor per branch --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 419c19c4..0e11b185 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -120,9 +120,9 @@ If you need the version of a package that is not programmatically loaded, i.e., To merge your new episodes: - Make a Pull request (PR). You can follow the stesp on [using GitHub](#using-github). -- Keep branches up to date with `main`. +- Keep your feature branch up to date with `main`. - This encourage to keep the history as linear as possible, prioritizing actions like ["rebase and merge"](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge) to accept the PR. - - In the local repository, follow all these five steps: + - In the local repository. First, make sure that you are the only contributor in the `feature` branch. Then, follow all these five steps: 1. Switch to the `main` branch: `git checkout main` 2. Pull the `main` branch: `git pull` 3. Switch to your `feature` branch: `git checkout feature` From 41a920d7ef822845214a92a8a02908779de64a81 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Tue, 19 Dec 2023 18:39:33 +0000 Subject: [PATCH 6/9] add step to pull changes from an online rebased PR branch --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0e11b185..7e42ba53 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -130,6 +130,7 @@ To merge your new episodes: 5. Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` - In the remote repository, i.e. on GitHub, only if you are in a PR: - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). + - To pull changes from an updated PR branch with rebase run: `git pull --rebase` From 0ac8b036afe55b4900e7bbdbbe39e0e51f1fc470 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Wed, 20 Dec 2023 11:46:04 +0000 Subject: [PATCH 7/9] rephrase from a frequent to an optional step. this follows the suggestion in https://github.com/epiverse-trace/tutorials/pull/97#discussion_r1431821920 --- CONTRIBUTING.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7e42ba53..94bf286c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -120,17 +120,16 @@ If you need the version of a package that is not programmatically loaded, i.e., To merge your new episodes: - Make a Pull request (PR). You can follow the stesp on [using GitHub](#using-github). -- Keep your feature branch up to date with `main`. - - This encourage to keep the history as linear as possible, prioritizing actions like ["rebase and merge"](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge) to accept the PR. - - In the local repository. First, make sure that you are the only contributor in the `feature` branch. Then, follow all these five steps: +- If you need to get the latest commits in the `main` branch to use them in your development, we recommend rebasing your feature branch. Rebase will keep the [commit history linear](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge). First, make sure that you are the only contributor in the `feature` branch, then: + - In the local repository, follow all these five steps: 1. Switch to the `main` branch: `git checkout main` 2. Pull the `main` branch: `git pull` 3. Switch to your `feature` branch: `git checkout feature` 4. [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` 5. Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` - - In the remote repository, i.e. on GitHub, only if you are in a PR: + - In the remote repository, only if you are in a PR: - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). - - To pull changes from an updated PR branch with rebase run: `git pull --rebase` + - To pull changes to your local repository from an updated PR branch with rebase in the remote, run: `git pull --rebase` From becb2393c007755ca5c775044eabf3cfb65cf38b Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Wed, 20 Dec 2023 11:49:15 +0000 Subject: [PATCH 8/9] isolate the merge list of actions --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 94bf286c..4c2e6b6c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -117,6 +117,7 @@ If you need the version of a package that is not programmatically loaded, i.e., - [Create](https://carpentries.github.io/sandpaper/articles/building-with-renv.html#adding-new-packages-to-the-cache) an `episodes/install.R` file that lists the installation scripts for the packages in your lesson. - Run the `episodes/install.R` file to install the list of packages. - Run `sandpaper::update_cache()`. Before you accept the update, verify that the expected version number is listed as an update. After this, review the `renv.lock` file if this modified the file as expected. + To merge your new episodes: - Make a Pull request (PR). You can follow the stesp on [using GitHub](#using-github). From bd5ede7ed79ffef1f79656446e7b446c2810acc4 Mon Sep 17 00:00:00 2001 From: Andree Valle Campos Date: Wed, 20 Dec 2023 11:54:18 +0000 Subject: [PATCH 9/9] relocate rebase action within the using github section --- CONTRIBUTING.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4c2e6b6c..172ff80a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -121,18 +121,6 @@ If you need the version of a package that is not programmatically loaded, i.e., To merge your new episodes: - Make a Pull request (PR). You can follow the stesp on [using GitHub](#using-github). -- If you need to get the latest commits in the `main` branch to use them in your development, we recommend rebasing your feature branch. Rebase will keep the [commit history linear](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge). First, make sure that you are the only contributor in the `feature` branch, then: - - In the local repository, follow all these five steps: - 1. Switch to the `main` branch: `git checkout main` - 2. Pull the `main` branch: `git pull` - 3. Switch to your `feature` branch: `git checkout feature` - 4. [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` - 5. Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` - - In the remote repository, only if you are in a PR: - - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). - - To pull changes to your local repository from an updated PR branch with rebase in the remote, run: `git pull --rebase` - - #### Reviewer: @@ -210,6 +198,20 @@ Each lesson has a team of maintainers who review issues and pull requests or encourage others to do so. The maintainers are community volunteers, and have final say over what gets merged into the lesson. +#### Rebase + +- If you need to get the latest commits in the `main` branch to use them in your development, we recommend rebasing your feature branch. Rebase will keep the [commit history linear](https://epiverse-trace.github.io/blueprints/git-branching-merging.html#merging-pull-requests-merge-commits-vs-squash-and-merge-vs-rebase-and-merge). First, make sure that you are the only contributor in the `feature` branch, then: + - In the local repository, follow all these five steps: + 1. Switch to the `main` branch: `git checkout main` + 2. Pull the `main` branch: `git pull` + 3. Switch to your `feature` branch: `git checkout feature` + 4. [Rebase](https://docs.gitlab.com/ee/topics/git/git_rebase.html) your `feature` branch onto `main` branch: `git rebase main` + 5. Push your rebased `featured` branch using the `--force` option (this must be a forced update): `git push --force` + - In the remote repository, only if you are in a PR: + - Update your PR branch with [Update with Rebase](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch#updating-your-pull-request-branch). + - To pull changes to your local repository from an updated PR branch with rebase in the remote, run: `git pull --rebase` + + ### Other Resources The Epiverse-TRACE is a global organisation with volunteers and learners all over