Skip to content

[Exercise Discussion] T6L2/branch-forward #66

@damithc

Description

@damithc

Existing exercise check

Lesson

https://nus-cs2103-ay2526s1.github.io/website/book/gitAndGithub/merge/index.html

Exercise learning outcomes

Able to fast-forward merging

Exercise setup

Inputs to the new.sh:

Exercise name: branch-forward
Tags (space separated): git-branch git-merge
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 ...): love-story
Git-Mastery Github repository title (defaults to ''): 
Initialize exercise repo as Git repository? (defaults to y)  [y/N]: Y

Equivalent steps to create the repo

echo -e "Harry was single." >> story.txt
git add .
git commit -m "Introduce Harry"

echo -e "Harry did not have a family." >> story.txt
git commit -am "Add about family"

git switch -c with-ginny
echo -e "Then he met Ginny." >> story.txt
git commit -am "Add about Ginny"

git switch main
echo -e "Harry" >> cast.txt
git add .
git commit -m "Add cast.txt"

git switch -c with-sally
echo -e "Then he met Sally" >> story.txt
git commit -am "Mention Sally"

git switch with-ginny
echo -e "Ginny was single too" >> story.txt
git commit -am "Mention Ginny is single"

Instructions for students

Scenario: You are writing the outline for a story. You now have two parallel storylines in two branches.

Task:

Merge only the branch(es) that can be fast-forwarded. Use fast-forward merging.

Tip: Ensure you have switched to the destination branch before initiating the merge.

Exercise grading

Verify that,

  • only with-sally is merged.
  • a fast-forward merge is used

Requires remote repository?

No response

Additional remarks

No response

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions