Skip to content

[Hands-On: remote-branch-pull-diverged] T8L2: Pull when local and remote have diverged #272

@damithc

Description

@damithc

HP_ID: see issue subject

Lesson: https://git-mastery.github.io/lessons/remoteBranchPull

This hands-on does not exist in the lesson yet. It will be added later to cover the following concepts.

Image

Hands-on setup

Hands-on name: {{ HP_ID }}
Requires Git? (defaults to y)  [y/N]: y
Requires Github? (defaults to y)  [y/N]: y
  1. Clone https://github.com/git-mastery/samplerepo-company-2 as samplerepo-company
  2. Pull the track-sales branch
  3. Delete the last two commit of that branch
  4. Nuke the reflog (git reflog expire --expire=now --all -> git gc --prune=now)
  5. Add a new commit to the track-sales branch, as follows:
echo "Refunds" > refunds.txt
git add refunds.txt
git commit -m "Add refunds.txt"

Now, it should look like someone added two new commits to the remote track-sales branch after it was pulled last, while there is also a new commit in the local branch (i.e., the two copies have diverged from each other)

Instructions for students

Run gitmastery download {{ HP_ID }} to create a fresh sandbox for this practical.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions