Learn GIT in a Day
A Comprehensive One-Day Crash Course on GIT

Hello, I'm Simran Bansal, a skilled graduate software engineer with expertise in C, Java, JavaScript, PHP, Python, SQL, data structures, functional programming, JSON, regular expressions, HTML, CSS, Bootstrap, React.js, Git, Jenkins, Selenium, Docker, AWS, Digital Ocean Droplets, Linode, Cloudflare Workers, Domain DNS, Nginx, Apache Hive, LaTeX, Eclipse, VS Code, Cucumber, SSH, Linux Administration, Kubernetes, and more. I am passionate about creating innovative software solutions that meet business requirements and exceed user expectations ๐.
Additionally, I have experience with tools and technologies such as Audacity, Affinity Designer, Affinity Photo, and Photoshop CS6 ๐ป.
My skills extend beyond technical expertise as I am also a skilled event coordinator, graphic designer, and project planner ๐จ. I enjoy working with teams to plan and execute projects and believe in the power of strategic planning to achieve success ๐ฏ. I am an enthusiastic teacher and enjoy sharing my knowledge and experiences with others ๐ก. However, my weakness is handwriting, and I don't particularly like long lectures ๐ .
Outside of work, my hobbies are badminton, dancing, drawing, singing, and writing ๐ธ. I am an avid consumer of anime, Marvel movies, and non-fiction, especially in the fields of technology, psychology, and computer programming ๐.
Throughout my career, I have developed small-scale software applications and small and medium-sized web applications, always focusing on teamwork and collaboration ๐ค. I am excited about the opportunities ahead and always eager to learn and grow in my field ๐.
Currently at Nokia, I'm eager to collaborate and contribute to exciting projects. Feel free to connect with me at queries@sibansal.dev to explore opportunities or share insights.
Welcome, everyone, to this one-day crash course on GIT! Whether you're new to version control or looking to refresh your skills, get ready for an exciting journey packed with learning and exploration.
Today, we'll cover the essentials of Git through a series of 18 exercises. Don't worry if you're new to this โ I'll take it step by step, ensuring you grasp each concept with ease.
Let's dive in! Below, you'll find the exercises designed to help you understand Git fundamentals. Feel free to move at your own pace, and remember, there's no rush!
Weapons you need in your arsenal
GIT Installed on your system (Download Here).
Any IDE (VS Code is recommended).
An account on Github (Create Here).
Git Exercises for College Students
Exercise 1: Initializing a Repository
Description: Initialize a new Git repository and create a
Readme.mdfile.Steps:
Open your terminal.
Navigate to the desired directory for your project.
Run the following commands:
git init echo "# My Project" > Readme.md git add Readme.md git commit -m "Initial commit: Add Readme.md"
Exercise 2: Making Changes
Description: Make changes to the
Readme.mdfile and commit them.Steps:
Open
Readme.mdin your preferred text editor.Add some text or make modifications to the file.
Save the changes.
Run the following commands:
git add Readme.md git commit -m "Update Readme.md: Add project description"
Exercise 3: Viewing Changes
Description: View the differences between commits.
Steps:
Make additional changes to the
Readme.mdfile.Save the changes.
Run the following command to view the differences:
git diff commit_id_1 commit_id_2
Exercise 4: Branching
Description: Create a new branch and switch to it.
Steps:
Run the following commands:
git branch feature git checkout featureMake changes to the
Readme.mdfile within thefeaturebranch.Add and commit the changes.
Exercise 5: Merging
Description: Merge changes from the
featurebranch into themainbranch.Steps:
Switch back to the
mainbranch:git checkout mainMerge changes from the
featurebranch:git merge feature
Exercise 6: Resolving Conflicts
Description: Simulate a merge conflict and resolve it.
Steps:
Make conflicting changes to the
Readme.mdfile in both themainandfeaturebranches.Attempt to merge the
featurebranch intomain:git merge featureResolve the conflicts in the file.
Add and commit the resolved file.
Exercise 7: Remote Repositories
Description: Connect your local repository to a remote repository on GitHub.
Steps:
Create a new repository on GitHub.
Follow the instructions on GitHub to add the remote repository URL to your local repository.
Push your local changes to the remote repository:
git push origin main
Exercise 8: Cloning
Description: Clone a repository from GitHub to your local machine.
Steps:
Find a repository on GitHub that you want to clone.
Copy the repository URL.
Open your terminal and navigate to the directory where you want to clone the repository.
Run the following command:
git clone <repository_url>
Exercise 9: Pulling Changes
Description: Fetch and merge changes from a remote repository.
Steps:
Navigate to your local repository.
Run the following command to fetch and merge changes from the remote repository:
git pull origin main
Exercise 10: Collaboration
Description: Collaborate with a classmate on a Git repository.
Steps:
Find a classmate to collaborate with.
Add them as a collaborator on your GitHub repository.
Have your classmate clone the repository to their local machine.
Make changes to the repository and push them to GitHub.
Fetch and merge their changes into your local repository.
Exercise 11: Undoing Changes
Description: Undo changes made to a file and discard them.
Steps:
Make changes to the
Readme.mdfile.Run the following command to discard the changes and revert to the last committed state:
git checkout -- Readme.md
Exercise 12: Stashing Changes
Description: Temporarily store changes to work on something else.
Steps:
Make changes to the
Readme.mdfile.Run the following command to stash the changes:
git stashMake additional changes or switch branches.
Retrieve the stashed changes:
git stash pop
Exercise 13: Rebasing
Description: Reapply commits on top of another branch.
Steps:
Create a new branch:
git branch experiment git checkout experimentMake changes and commit them.
Switch back to the
mainbranch:git checkout mainRun the following command to rebase the
experimentbranch ontomain:git rebase experiment
Exercise 14: Viewing History
Description: View commit history and explore different options.
Steps:
Run the following command to view commit history:
git logExplore different options such as formatting, filtering by author, date range, etc.
Exercise 15: Tagging Releases
Description: Tag a specific commit as a release.
Steps:
Identify the commit you want to tag:
git logRun the following command to tag the commit:
git tag v1.0 <commit_id>Push the tag to the remote repository:
git push origin v1.0
Exercise 16: Collaborative Workflow
Description: Simulate a typical collaborative workflow with branching and merging.
Steps:
Divide into pairs (A and B).
A creates a new branch, makes changes, and commits them.
A pushes the branch to the remote repository.
B pulls the branch, reviews the changes, and merges them into the
mainbranch.Switch roles and repeat the process.
Exercise 17: Gitignore
Description: Ignore certain files or directories from version control.
Steps:
Create a
.gitignorefile in the root of your repository.Add file patterns or directory names to ignore.
Commit the
.gitignorefile.Verify that ignored files are not included in Git's tracking.
Exercise 18: Git Hooks
Description: Automate tasks with Git hooks.
Steps:
Create a Git hook script (e.g., pre-commit, post-commit) in the
.git/hooksdirectory of your repository.Add desired commands or scripts to the hook.
Make changes and commit to trigger the hook.
Verify that the hook executes the specified tasks.
Congratulations on embarking on this learning journey! By the end of the day, you'll have a solid foundation in Git and be well-prepared to continue exploring on your own.
Thank you for joining us today. Let's make the most of our time and dive into the exciting world of version control with Git!
