Hey Devs! 👋

If you've been pushing, pulling, and committing for a while, it's time to take the next big step: mastering Git workflows and advanced commands!
Today, let’s go through branching, checkout, pull requests, and dive deep into powerful Git commands that will make you a true Git wizard! 🧙‍♂️✨

GitHub Workshop on Committing Text Files

Date: 24th April 2025 (Day 02)

Conducted by: Mr. Santhosh N.C.

Submitted By:

  • Name: Santhosh S
  • Department: MCA
  • Roll Number: 24MCR092

Workshop Overview

Santhosh N.C. sir led an insightful and hands-on workshop aimed at helping participants understand the fundamentals of Git and GitHub. 🌿 Step 1: Create a Branch and Checkout
When working on a new feature or bug fix, never work directly on main.
Instead, create a new branch:

🚀 Mastering Git: Advanced Commands & Workflow Guide

Welcome to your ultimate guide on advanced Git commands!

This document covers branch creation, checkout, pull requests, and pro-level Git techniques to boost your development workflow. 🧠⚡


🌿 1. Creating a Branch and Checking Out

Start by creating a new branch to keep your work clean and organized:

git checkout -b feature/your-feature-name
✅ This creates and switches to a new branch.

Example:
git checkout -b feature/login-page

✍️ 2. Making Changes and Committing

After making your changes:

git add .
git commit -m "feat: Add login page UI"
Tip: Write meaningful and concise commit messages.

🚀 3. Pushing Your Branch

Push your new branch to the remote repository:

git push origin feature/login-page
Now your work is safely on GitHub or your Git server!

📬 4. Creating a Pull Request (PR)

Navigate to your GitHub repository.

Click "Compare & pull request."

Add a clear title and description.

Assign reviewers if needed.

Submit!

Pull requests enable peer review, collaboration, and safer merges.

⚡ Advanced Git Commands
🔥 Stash Changes: git stash
Temporarily save your changes without committing:

git stash
Apply the stash later:

git stash pop
View stashed changes:

git stash list
🎯 Cherry-Pick Commits: git cherry-pick
Apply a specific commit from another branch:

git cherry-pick
Useful for hotfixes without merging entire branches.

🎨 Rebase for Clean History: git rebase
Interactively squash, edit, or delete commits:

git rebase -i HEAD~n
Where n = number of commits you want to review.

🧹 Clean Untracked Files: git clean
Preview files to be deleted:

git clean -n
Actually delete them:

git clean -f
Delete directories too:
git clean -fd
⚠️ Warning: Irreversible action.

🕵️‍♂️ Find Bugs Fast: git bisect
Find the commit that introduced a bug:

git bisect start
git bisect bad
git bisect good
Git will guide you to the exact faulty commit using binary search!

🔥 Recover Anything: git reflog
See the history of your HEAD movements:

git reflog
Recover lost commits easily by checking out the previous states.

Example:

git checkout
🧠 Reset HEAD: git reset
Move HEAD to a previous state:

Soft reset (keep changes staged):

git reset --soft HEAD~1
Mixed reset (unstage changes):
git reset --mixed HEAD~1
Hard reset (discard changes):

git reset --hard HEAD~1

🚀 Safe Undo with Revert: git revert

Undo a commit without rewriting history:

git revert
Recommended for public/shared branches.

🏷️ Tagging Releases: git tag
Create a tag:

git tag v1.0.0
Push tags to the remote:

git push origin --tags
Tagging helps in tracking production-ready versions.

🔄 Fetch vs Pull
git fetch → Download updates without merging.

git pull → Download and merge immediately.

Best practice:

git fetch
git merge origin/main
📋 Quick Commands Table

Command Description

git stash Save changes temporarily
git cherry-pick Apply specific commits
git rebase -i Interactive rebase for clean commits
git clean Delete untracked files and folders
git bisect Find faulty commits
git reflog Recover lost work
git reset Move HEAD to earlier commit
git revert Safely undo a commit
git tag Mark release versions

📖 Best Practices

Always branch out for new features.

Create pull requests for every feature/bugfix.

Use stash to avoid losing uncommitted work.

Use rebase to maintain clean and readable commit history.

Never use reset --hard on shared branches unless absolutely necessary.

Use reflog when you think all hope is lost — it’s your Git lifeline!

✨ Final Words

"Git mastery isn’t about memorizing commands; it’s about understanding when and why to use them." 🚀

Keep practicing and soon Git will feel like an extension of your hands! 🧠💻

🙌 Happy Coding!
Feel free to clone, fork, and share this guide! ⭐

Conclusion
The workshop by Santhosh N.C. sir successfully introduced students to GitHub and core Git commands. It was a valuable and practical session that enhanced students' technical skills for real-world project collaboration.