0% found this document useful (0 votes)
10 views2 pages

Git Assignment 2

The document outlines a series of Git tasks to be completed in a project repository, including creating and managing branches, committing changes, merging branches, and handling remote repositories. Specific commands are required for each task, such as creating files, switching branches, and pushing changes. The assignment emphasizes the use of updated terminology and practices in version control.

Uploaded by

Falak Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Git Assignment 2

The document outlines a series of Git tasks to be completed in a project repository, including creating and managing branches, committing changes, merging branches, and handling remote repositories. Specific commands are required for each task, such as creating files, switching branches, and pushing changes. The assignment emphasizes the use of updated terminology and practices in version control.

Uploaded by

Falak Sardar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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.

You might also like