Module 5 - Git & Github

Lab 1: Initialize & Configure a Git Repository

  • How do you create a new folder named project-lab1 and initialize a Git repository?

  • How do you configure Git username and email?

  • How do you create a file, add content, and commit the changes?

  • How do you connect the local repo to a new GitHub repository?

  • How do you push your commits to GitHub?


Lab 2: Branching & Switching Branches

  • How do you create a new branch named feature-ui?

  • How do you switch between main and feature-ui?

  • How do you add separate commits on each branch?

  • How do you view branch history and differences between branches?


Lab 3: Merge Requests & Merging Branches

  • How do you create a new branch named feature-auth?

  • How do you make two commits on this branch and push it to GitHub?

  • How do you create a Pull Request (PR) on GitHub?

  • How do you merge the PR and pull the updated changes locally?


Lab 4: Delete Local & Remote Branches

  • How do you create a branch named temp-update?

  • How do you make a commit and merge it into main?

  • How do you delete the branch locally?

  • How do you delete the branch remotely from GitHub?


Lab 5: Add & Manage .gitignore

  • How do you create the folders logs/, temp/, and node_modules/?

  • How do you create a .gitignore file and add ignore patterns?

  • How do you verify that the files are being ignored?

  • How do you commit the .gitignore?


Lab 6: Stash Your Work

  • How do you edit multiple tracked files and stash the changes with a message?

  • How do you switch to another branch while changes are stashed?

  • How do you apply the stash back using git stash pop?

  • How do you delete the applied stash entry?


Lab 7: Undoing Work

  • How do you create a wrong commit?

  • How do you undo the commit using git reset --soft but keep the changes?

  • How do you create another wrong commit?

  • How do you revert it using git revert <commit>?

  • How does the repository history look after reset vs revert?


Lab 8: Rebasing Practice

  • How do you create two branches: main and feature-api?

  • How do you add commits to both branches?

  • How do you rebase feature-api on top of main?

  • How do you resolve rebase conflicts?

  • How do you force-push the rebased branch?


Lab 9: Git Hooks Automation

  • How do you create a pre-commit hook inside .git/hooks?

  • How do you write a script that prevents commits containing the word DEBUG?

  • What happens when you attempt to commit a file with DEBUG?

  • What happens when you commit a clean file?


Lab 10: Cherry-Picking, Reflog & Checkout History

  • How do you create two branches named alpha and beta?

  • How do you make different commits on each branch?

  • How do you cherry-pick a commit from beta to alpha?

  • How do you inspect commit history using git reflog?

  • How do you check out an older commit (detached mode) and then return to the latest commit?

Last updated