File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -512,6 +512,45 @@ if there are commits on the remote branch
512512you would override by pushing if you forgot
513513to check yourself.
514514
515+ ## Pulling a Rebased Branch
516+
517+ If you have rebased a feature branch
518+ and then overwritten the remote branch
519+ on GitHub your collaborators may need to pull
520+ these changes to their local copies.
521+
522+ If the collaborator already had a copy
523+ of your branch from before the rebase;
524+ attempting a normal pull will result in a
525+ lot of conflicts due to the incompatible
526+ histories of the original and the rebased
527+ branches.
528+
529+ The collaborator should
530+ first switch to the local branch they want to
531+ overwrite with the rebased remote version:
532+
533+ ``` bash
534+ $ git switch add_plot_script
535+ ```
536+
537+ Now fetch but don't attempt to merge the
538+ remote branch:
539+
540+ ``` bash
541+ $ git fetch origin add_plot_script
542+ ```
543+
544+ Reset the local branch to match the remote origin:
545+
546+ ``` bash
547+ $ git reset --hard origin/add_plot_script
548+ ```
549+
550+ Now their local branch matches the rebased
551+ feature branch from GitHub and
552+ everyone's branches are in sync.
553+
515554::::::::::::::::::::::::::::::::::::::: challenge
516555
517556## Modifying Commit Messages
Original file line number Diff line number Diff line change 1212"episodes/06-conflict.md" "2d24ee01ff240b5b128a8574a18ab12f" "site/built/06-conflict.md" "2024-11-19"
1313"episodes/07-history.md" "ef0866f16853f3c708c2bfea2d3ef4b4" "site/built/07-history.md" "2024-12-02"
1414"episodes/End.md" "c34fe594102fe3c81f4bad2c5c7bbbfc" "site/built/End.md" "2024-12-02"
15- "episodes/08-rebase.md" "b0aa291d41fe59e4604ace8f354ace21 " "site/built/08-rebase.md" "2024-12-02"
15+ "episodes/08-rebase.md" "d3caf47ed218f5655c948f06551f3a55 " "site/built/08-rebase.md" "2024-12-02"
1616"episodes/09-pre-commit.md" "99096b6d10f4f7c1f6f5bfa72f728e45" "site/built/09-pre-commit.md" "2024-12-02"
1717"instructors/instructor-notes.md" "a5d4cdfe96cb07fe8460111021491b58" "site/built/instructor-notes.md" "2024-11-19"
1818"learners/discuss.md" "aaef6991af918125ae722d3ce4e36443" "site/built/discuss.md" "2024-11-19"
You can’t perform that action at this time.
0 commit comments