Skip to content

Add in instructions for updating a local branch that was rebased on the remote. #18

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

Merged
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
39 changes: 39 additions & 0 deletions episodes/08-rebase.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,45 @@ if there are commits on the remote branch
you would override by pushing if you forgot
to check yourself.

## Pulling a Rebased Branch

If you have rebased a feature branch
and then overwritten the remote branch
on GitHub your collaborators may need to pull
these changes to their local copies.

If the collaborator already had a copy
of your branch from before the rebase;
attempting a normal pull will result in a
lot of conflicts due to the incompatible
histories of the original and the rebased
branches.

The collaborator should
first switch to the local branch they want to
overwrite with the rebased remote version:

```bash
$ git switch add_plot_script
```

Now fetch but don't attempt to merge the
remote branch:

```bash
$ git fetch origin add_plot_script
```

Reset the local branch to match the remote origin:

```bash
$ git reset --hard origin/add_plot_script
```

Now their local branch matches the rebased
feature branch from GitHub and
everyone's branches are in sync.

::::::::::::::::::::::::::::::::::::::: challenge

## Modifying Commit Messages
Expand Down