Updating the base of a branch

Report a typo

You are working in a development environment with a Git repository that has multiple branches and commits. Your task is to write a Git command to modify the base of a branch.

The repository is set up as follows:

  • The main branch has an initial commit;

  • A feature branch is created from main. On feature, a commit "Feature commit 1" is made;

  • An update branch is created from the feature branch at the state of "Feature commit 1";

  • Then, on the feature branch, another commit "Feature commit 2" is added;

  • Finally, on the update branch, a commit "Update commit 1" is created.

Your task is to rebase the update branch so that its base is updated from "Feature commit 1" to "Feature commit 2". In other words, after rebasing, the parent of "Update commit 1" on the update branch should be "Feature commit 2" (the latest commit on feature).

Write your Git command(s) below line by line.

Write a program
# Write your solution below

___

Create a free account to access the full topic