File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -512,6 +512,45 @@ if there are commits on the remote branch
512
512
you would override by pushing if you forgot
513
513
to check yourself.
514
514
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
+
515
554
::::::::::::::::::::::::::::::::::::::: challenge
516
555
517
556
## Modifying Commit Messages
You can’t perform that action at this time.
0 commit comments