| Item | Detail |
|---|---|
| User | +++@lab.VirtualMachine(desktop1).Username+++ |
| Password | +++@lab.VirtualMachine(desktop1).Password+++ |
Initialize a new Git repository and configure it with proper user settings and understand the basic Git workflow.
Requirements:
- Create a new directory called
git-fundamentals-projectin your home directory - Navigate into the directory and initialize a new Git repository
- Configure Git with your name and email address (use test values)
- Create a
.gitignorefile that ignores common temporary files (*.tmp, *.log, .DS_Store) - Create an initial
README.mdfile with a project description - Stage and commit the initial files with a descriptive commit message
- Check the repository status and commit history
- Document all commands used in
git-setup-log.txt
Demonstrate understanding of Git's three states (working directory, staging area, repository) through practical file operations.
Requirements:
- Create three new files:
main.py,utils.py, andconfig.json - Add some content to each file
- Use
git statusto check the current state - Add only
main.pyto the staging area - Check status again to see the difference
- Modify
main.pyafter staging it - Use
git diffto see the differences between working directory and staging area - Use
git diff --cachedto see differences between staging area and repository - Stage all files and commit them with a meaningful message
- Document the different states and commands in
git-states-explanation.txt
Explore Git's history features and understand how to navigate and analyze commit history.
Requirements:
- Make at least 3 more commits by modifying different files
- Each commit should have a clear, descriptive message
- Use
git logto view the commit history - Use
git log --onelineto see a condensed history - Use
git log --graph --onelineto see a graphical representation - Use
git show <commit-hash>to examine a specific commit - Save the complete log output to
commit-history.txt - Create a file called
git-log-analysis.txtexplaining what each log command shows - Use
git log --author="YourName"to filter commits by author - Document your findings about different log formats and options
Create and work with Git branches to understand non-linear development workflows.
Requirements:
- Create a new branch called
feature-development - Switch to the new branch and verify you're on it
- Create a new file called
feature.pyand add some content - Commit the new file on the feature branch
- Switch back to the main branch and verify the file doesn't exist there
- Create another branch called
bugfixfrom main - Switch to bugfix branch and modify an existing file
- Commit the changes on the bugfix branch
- Switch back to main and merge the bugfix branch
- List all branches and show which branch you're currently on
- Document the branching workflow in
branching-workflow.txt - Create a summary of all Git commands learned in
git-commands-summary.txt
Demonstrate understanding of Git best practices and create a complete project workflow.
Requirements:
- Create a
developmentbranch for ongoing work - Make several commits on the development branch with good commit messages
- Use
git commit --amendto modify the last commit message - Create a
docsfolder with documentation files - Use
git add .andgit add -Ato understand the difference - Practice using
git resetto unstage files (without losing changes) - Use
git checkoutto discard changes in working directory - Create a comprehensive
git-workflow-guide.txtthat explains:- When to use different Git commands
- Best practices for commit messages
- When and how to use branches
- Common Git workflows
- Demonstrate understanding by creating a clean commit history
- Save final repository state and verify everything is properly committed
@lab.Activity(CFU2)