Assignment 2
Date 07/08/25
(Note main is an alternative name used instead of master. It is the newer convention
that is followed. The use of main/master to indicate the primary branch changes from
organisation to organisation)
1. Create a New Branch: In your my_project repository, create a
new branch called feature-login. Switch to this branch. Provide
the commands used.
2. Commit Changes on a Branch: On the feature-login branch,
create a file [Link] with a print statement. Stage and commit
it with the message. List the commands.
3. Switch Between Branches: Switch from the feature-login
branch back to the main branch in my_project. Verify which
branch you are on. Provide the commands used.
4. Merge a Branch: Merge the feature-login branch into the main
branch in my_project. Assume no conflicts. Provide the
commands used.
5. List All Branches: Display all branches in my_project,
indicating the current branch. Provide the command.
6. Checkout a Specific Commit: In my_project, find the commit
hash of the "Initial commit" (use git log --oneline). Check out
that specific commit in a detached HEAD state. Provide the
commands used.
7. Create and Push a Branch: Create a new branch docs in
my_project. Add a file [Link] with a project description,
commit it with the message "Add README", and push the
docs branch to the remote repository (my_project_remote).
List the commands.
8. Pull Changes from Remote: On the main branch in my_project,
assume a collaborator has pushed new commits to the
remote repository. Pull these changes to your local repository.
Provide the command.
9. Create Multiple Commits on a Branch: On the docs branch,
create a file [Link] with a contribution guideline.
Commit it with the message "Add [Link]". Then,
add a line to [Link] and commit it with the message
"Update README". List the commands.
10. Delete a Branch: After merging feature-login into main,
delete the feature-login branch locally and remotely. Provide
the commands used.
11. Checkout a Commit and Create a Branch: In my_project,
check out the commit where [Link] was added (use git log
--oneline to find the hash). Create a new branch login-rework
from that commit. Provide the commands used.
12. Push Multiple Commits to Remote: On the docs branch,
add a comment to [Link] and commit with the message
"Add comment to README". Then, create a file [Link]
and commit with the message "Add LICENSE". Push these
commits to the remote repository. List the commands.