Skip to content

Commit ec2c34e

Browse files
MetOffice#52 Add in some extra clarifications on how to check if a rebase worked
1 parent 43d16b1 commit ec2c34e

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

episodes/08-rebase.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,16 @@ $ git log --decorate --oneline --graph
388388
* ed14d18 (origin/main) Adds Robert FitzRoy as an author (#8)
389389
```
390390

391+
It's a good idea here to diff against
392+
your backup branch to check that you
393+
haven't accidentally removed changes.
394+
395+
```bash
396+
$ git diff add_plot_script.backup add_plot_script
397+
```
398+
399+
This command should show **no** output.
400+
391401
::: callout
392402

393403
## detached HEAD
@@ -410,21 +420,6 @@ output above, on the feature branch.
410420

411421
## Updating a Branch
412422

413-
::::::::::::::::::::::::::::::::::::: instructor
414-
415-
To ensure the `main` branch of the
416-
`git-training-demo` repository has
417-
moved forward one commit, the co-instructor
418-
should merge a PR making any change
419-
they like to the repository.
420-
421-
Or they can make a direct edit and merge
422-
to main by for example editing the `README.md`
423-
file and using their branch protection
424-
override.
425-
426-
::::::::::::::::::::::::::::::::::::::::::::::::
427-
428423
You can also use rebase to move your changes to
429424
branch off the `HEAD` of `main`.
430425
While we rebased our feature branch another
@@ -458,9 +453,7 @@ gitGraph
458453
commit id: 'd7def6a'
459454
```
460455

461-
Go back to your fork on GitHub
462-
and click on the [**Sync fork**](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) button.
463-
Then run `git pull` to fetch the changes:
456+
Run `git pull` to fetch the changes from GitHub:
464457

465458
```bash
466459
$ git pull origin main
@@ -492,6 +485,24 @@ is difficult to impossible.
492485

493486
:::
494487

488+
### Updating a Branch with Upstream Changes
489+
490+
Go back to your fork on GitHub
491+
and click on the [**Sync fork**](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) button.
492+
493+
Then you can follow the steps above to update
494+
your branch.
495+
496+
It's a good idea to diff your origin feature branch here.
497+
498+
```bash
499+
$ git diff feature origin/feature
500+
```
501+
502+
You should only see the changes brought
503+
in from the upstream repository **not**
504+
your feature branch changes.
505+
495506
## Updating the Remote
496507

497508
If you are rebasing a feature branch you have

0 commit comments

Comments
 (0)