-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Labels
approvedexercise discussionDiscussion about the design of an exerciseDiscussion about the design of an exercise
Description
Existing exercise check
- I have verified that this exercise is not yet already in discussion, in progress, or exists
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 fast-forward merge
Exercise setup
Inputs to the new.sh:
Exercise name: ff-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 others
echo -e "No job" >> birdperson.txt
git add .
git commit -m "Add Birdperson"
echo -e "Cyborg" >> birdperson.txt
git add .
git commit -m "Add Cyborg to birdperson.txt"
echo -e "Spy" >> tammy.txt
git add .
git commit -m "Add Tammy"
git switch main
git merge others -m "Introduce others"
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 added a few other characters in a separate branch others.
gitGraph BT:
commit id: "Add Rick"
commit id: "[main] Add Morty"
branch others
commit id: "Add Birdperson"
commit id: "Add Cyborg to birdperson.txt"
commit id: "[HEAD → other] Add Tammy"
Just now, you did a fast-forward merge of the others branch to the main branch.
gitGraph BT:
commit id: "Add Rick"
commit id: "Add Morty"
commit id: "Add Birdperson"
commit id: "Add Cyborg to birdperson.txt"
commit id: "[HEAD → main][others] Add Tammy"
However, now you realise this is premature, and wish to undo that change.
Task:
Undo the merging of branch others.
The result should be as follows:
gitGraph BT:
commit id: "Add Rick"
commit id: "[HEAD → main] Add Morty"
branch others
commit id: "Add Birdperson"
commit id: "Add Cyborg to birdperson.txt"
commit id: "[other] Add Tammy"
Exercise grading
Verify that,
- the merge has been undone
Requires remote repository?
No response
Additional remarks
No response
Metadata
Metadata
Assignees
Labels
approvedexercise discussionDiscussion about the design of an exerciseDiscussion about the design of an exercise