-
Notifications
You must be signed in to change notification settings - Fork 25
Description
Existing exercise check
- I have verified that this exercise is not yet already in discussion, in progress, or exists
Lesson
This exercise will appear at the bottom of the tour https://nus-cs2103-ay2526s1.github.io/website/book/gitAndGithub/trail/branchingLocally/index.html
Exercise learning outcomes
It covers all topics of the above tour, including detours
Exercise setup
Inputs to the new.sh:
Exercise name: mix-messy-graph
Tags (space separated): git-branch git-merge
Requires Git? (defaults to y) [y/N]: y
Requires Github? (defaults to y) [y/N]: y
Exercise repo type (local, remote, or ignore) (defaults to 'local'): local
Exercise repo name (defaults to ...): user-docs
Git-Mastery Github repository title (defaults to ''):
Initialize exercise repo as Git repository? (defaults to y) [y/N]: Y
Clone gm-user-docs as user-docs.
git remote remove origin # delete remote ref to make this a local repo
git checkout main
git merge feature-search --no-ff -m "Merge search feature"
The result should be as follows:
gitGraph BT:
commit id: "Add features.md"
commit id: "Mention feature for creating books" tag: "v10"
branch feature-search
branch feature-delete
branch list
checkout feature-delete
commit id: "Mention feature for deleting books"
checkout feature-search
commit id: "Mention feature for searching books"
checkout feature-delete
commit id: "Add missing period"
checkout main
commit id: "Fix phrasing of heading"
checkout feature-search
commit id: "Add more details on the search feature"
checkout list
commit id: "Add partial docs for listing books"
checkout main
merge feature-search id: "Merge search feature"
Instructions for students
Scenario: You are writing user documentation for a product. You have already written documentation for a few new features, each in a separate branch. After merging the feature-search branch, you realise this way of merging can result in a complicated revision graph. Instead, you wish to merge these changes in a way that results in a simple linear revision graph.
Task:
-
Undo the merging of
feature-search. -
Squash-merge the
feature-searchbranch onto themainbranch with the commit messageAdd the search feature. Delete thefeature-searchbranch. -
Similarly, squash-merge and delete the
feature-deletebranch with the commit messageAdd the delete feature, while resolving any merge conflicts -- in thefeatures.md, the delete feature should appear after the search feature (expected content given below):# Features ## Creating Books Allows creating one book at a time. ## Searching for Books Allows searching for books by keywords. Works only for book titles. ## Deleting Books Allows deleting books. -
The
listbranch is not needed, as you have decided not to have that feature. Delete that branch.
The resulting revision graph should be as follows:
gitGraph BT:
commit id: "Add features.md"
commit id: "Mention feature for creating books" tag: "v10"
commit id: "Fix phrasing of heading"
commit id: "Add the search feature"
commit id: "Add the delete feature"
Exercise grading
Verify the revision graph is as expected.
Verify the features.md file has the expected contents. OK to have minor variations in blank lines.
Requires remote repository?
Yes. https://github.com/git-mastery/gm-user-docs
Additional remarks
No response