@@ -388,6 +388,16 @@ $ git log --decorate --oneline --graph
388
388
* ed14d18 (origin/main) Adds Robert FitzRoy as an author (#8)
389
389
```
390
390
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
+
391
401
::: callout
392
402
393
403
## detached HEAD
@@ -410,21 +420,6 @@ output above, on the feature branch.
410
420
411
421
## Updating a Branch
412
422
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
-
428
423
You can also use rebase to move your changes to
429
424
branch off the ` HEAD ` of ` main ` .
430
425
While we rebased our feature branch another
@@ -458,9 +453,7 @@ gitGraph
458
453
commit id: 'd7def6a'
459
454
```
460
455
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:
464
457
465
458
``` bash
466
459
$ git pull origin main
@@ -492,6 +485,24 @@ is difficult to impossible.
492
485
493
486
:::
494
487
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
+
495
506
## Updating the Remote
496
507
497
508
If you are rebasing a feature branch you have
0 commit comments