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

[TASK] Polish the git rebasing section in CONTRIBUTING.md #1387

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ To rebase a feature branch to the latest `main`:
1. Make sure that your local copy of the repository has the most up-to-date
revisions of `main` (this is important, otherwise you may end up rebasing to
an older base point):
```sh
git checkout main
```bash
Copy link
Contributor

Choose a reason for hiding this comment

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

This was missed in #1366.

git switch main
Copy link
Contributor

Choose a reason for hiding this comment

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

New in Git 2.23 - additional separate commands added to declutter the overloaded functionality of checkout. Since this was released more than 5 years ago, I think it's safe to assume most people will have a version which supports this command.

git pull
```
1. Switch to the (feature) branch to be rebased and make sure your copy is up to
date:
```sh
git checkout feature/something-cool
```bash
git switch feature/something-cool
git pull
```
1. Consider taking a copy of the folder tree at this stage; this may help when
resolving conflicts in the next step.
1. Begin the rebasing process
```sh
```bash
git rebase main
```
1. Resolve the conflicts in the reported files. (This will typically require
Expand All @@ -168,8 +168,8 @@ To rebase a feature branch to the latest `main`:

If there were no conflicts, skip this and the next step.
1. Mark the conflicting files as resolved and continue the rebase
```sh
git add *.*
```bash
git add .
Copy link
Contributor

@JakeQZ JakeQZ Jan 6, 2025

Choose a reason for hiding this comment

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

From what I understand, this means that git will do the file system traversal, rather than the shell, which is probably better due to being OS-independent.

git rebase --continue
```
(You can alternatively use more specific wildcards or specify individual
Expand All @@ -180,7 +180,7 @@ To rebase a feature branch to the latest `main`:
If there are more conflicts to resolve, repeat the previous step then this
step again.
1. Force-push the rebased (feature) branch to the remote repository
```sh
```bash
git push --force
```
The `--force` option is important. Without it, you'll get an error with a
Expand Down