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

add rebase how-to steps and one per branch suggestion #97

Merged
merged 9 commits into from
Dec 20, 2023
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -119,11 +120,17 @@ 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.
Copy link
Member

Choose a reason for hiding this comment

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

Keeping in sync with main may not be necessary in most cases. git/GitHub is very good at identifying potential sources of conflicts and unless you get a message saying you have conflicts that you need to solve, rebasing your branch or merging the main branch into feature is extra work for (almost) no gain.

The linearity of this history is unrelated to our well you keep in sync with main. It is ensured by the absence of merge commits in the history.

Copy link
Member

@Bisaloo Bisaloo Dec 19, 2023

Choose a reason for hiding this comment

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

Typically, in the present PR, it was probably not necessary to rebase on main, even after your latest commits. You can do it, but it's an extra source of potential mistakes.

Copy link
Member Author

@avallecam avallecam Dec 19, 2023

Choose a reason for hiding this comment

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

From all these experiences, I confirm that this added unintentional extra mistakes.

So, I think we could change the "Keep your feature branch..." line as an optional action:

If you need to get the latest commits in the main branch to use them in your development, we recommend rebasing your feature branch. This will keep to commit history linear.

  • In the local repository...
    1. switch...
    2. pull...
      ...
  • In the remote...

Copy link
Member

Choose a reason for hiding this comment

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

Yes, sounds perfect!

Copy link
Member Author

Choose a reason for hiding this comment

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

added in 0ac8b03

- 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. 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`
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).
<!-- - Go to Git tab in the environments pane. Click on `Pull options` > `Pull with rebase`.-->


#### Reviewer:
Expand Down
Loading