Skip to content

[Exercise Discussion] T6L2/merge-undo #67

@damithc

Description

@damithc

Existing exercise check

Lesson

https://nus-cs2103-ay2526s1.github.io/website/book/gitAndGithub/merge/index.html (see detour: Undoing a Merge)

Exercise learning outcomes

Able to undo a merge

Exercise setup

Inputs to the new.sh:

Exercise name: merge-undo
Tags (space separated): git-branch git-merge git-reset
Requires Git? (defaults to y)  [y/N]: y
Requires Github? (defaults to y)  [y/N]: N
Exercise repo type (local, remote, or ignore) (defaults to 'local'): local
Exercise repo name (defaults to ...): play-characters
Git-Mastery Github repository title (defaults to ''): 
Initialize exercise repo as Git repository? (defaults to y)  [y/N]: Y

Equivalent steps to populate the repo

echo -e "Scientist" >> rick.txt
git add .
git commit -m "Add Rick"

echo -e "Boy" >> morty.txt
git add .
git commit -m "Add morty"

git switch -c daughter
echo -e "Vet" >> beth.txt
git add .
git commit -m "Add Beth"

git switch -c son-in-law main
echo -e "Salesman" >> jerry.txt
git add .
git commit -m "Add Jerry"

git switch main
echo -e "Grandson" >> morty.txt
git commit -am "Mention Morty is grandson"

git switch main
git merge daughter -m "Introduce Beth"
git merge son-in-law -m "introduce Jerry"

Instructions for students

Scenario: You are keeping notes on the characters of a play that you are writing. In the main story line (which is in the main branch), you introduced two characters, Rick and Morty. You had two other characters in two separate branches daughter and son-in-law. Just now, you introduced these two characters to the main story line by merging the two branches to the main branch.

// insert the current revision graph here

However, now you realise this is premature, and wish to undo that change.

Task:

Undo the merging of branches son-in-law and daughter.

The result should be as follows:

// insert the expected revision graph here

Exercise grading

Verify that,

  • both merges have been undone
  • main is pointing to the correct commit

Requires remote repository?

No response

Additional remarks

No response

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions