In this lab, you will learn about version control systems and their importance in collaborative software development. You will specifically focus on Git, one of the most widely used version control systems. Follow the tasks below to complete the lab assignment.
Objective: Understand how Git stores data.
- Create and Explore a Repository:
-
Use the current repository and make a few commits.
-
Use
git cat-file
to inspect the contents of blobs, trees, and commits.# Example commands to inspect contents git cat-file -p <blob_hash> git cat-file -p <tree_hash> git cat-file -p <commit_hash>
-
Create a
submission3.md
file. -
Provide the output in the
submission3.md
file.
-
Objective: Practice using different ways to use the git reset
command.
-
Create a New Branch:
-
Create a new branch named "git-reset-practice" in your Git repository.
git checkout -b git-reset-practice
-
-
Explore Advanced Reset and Reflog Usage:
-
Create a series of commits.
echo "First commit" > file.txt git add file.txt git commit -m "First commit" echo "Second commit" >> file.txt git add file.txt git commit -m "Second commit" echo "Third commit" >> file.txt git add file.txt git commit -m "Third commit"
-
Use
git reset --hard
andgit reset --soft
to navigate the commit history.git reset --soft HEAD~1 git reset --hard HEAD~1
-
Use
git reflog
to recover commits after a reset.git reflog git reset --hard <reflog_hash>
-
-
Documentation:
- Document the steps taken and push the final state to GitHub.
- Document your practice in the
submission3.md
file and include the following details:- Steps you took to perform the Git reset operations.
- Explain the reset and reflog process in the
submission3.md
. - Examples and outputs of the commands executed.
- Use proper Markdown formatting for documentation files.
- Organize files with appropriate naming conventions.
- Create a Pull Request to the main branch of the repository with your completed lab assignment.
Note: Actively explore and document your findings to gain hands-on experience with Git.