diff --git a/level-2-git-github/basics/README.md b/level-2-git-github/basics/README.md new file mode 100644 index 0000000..793a727 --- /dev/null +++ b/level-2-git-github/basics/README.md @@ -0,0 +1,158 @@ +#!/bin/bash + +######################################################## +# 🚀 GIT & GITHUB – LEVEL 1 (BEGINNER) +# This script explains basic Git + GitHub workflow +# You can read, copy, and execute commands step by step +######################################################## + + +############################ +# 1️⃣ CHECK GIT INSTALLATION +############################ +git --version +# If not installed (Ubuntu): +# sudo apt install git -y + + +############################ +# 2️⃣ CONFIGURE GIT (ONE TIME) +############################ +git config --global user.name "Your Name" +git config --global user.email "your-email@gmail.com" + +# Verify config +git config --list + + +############################ +# 3️⃣ CREATE A PROJECT FOLDER +############################ +mkdir Devops +cd Devops + + +############################ +# 4️⃣ INITIALIZE GIT REPO +############################ +git init +# Creates .git folder (Git starts tracking) + + +############################ +# 5️⃣ CREATE A FILE +############################ +echo "Hello DevOps" > README.md +ls + + +############################ +# 6️⃣ CHECK GIT STATUS +############################ +git status +# Shows untracked / modified files + + +############################ +# 7️⃣ ADD FILES TO STAGING AREA +############################ +git add README.md +# OR add all files: +# git add . + + +############################ +# 8️⃣ COMMIT CHANGES +############################ +git commit -m "Initial commit" +# Saves snapshot to local repo + + +############################ +# 9️⃣ CREATE GITHUB REPOSITORY +############################ +# Go to GitHub → New Repository → Create repo (NO README) +# Copy the repo URL + + +############################ +# 🔟 ADD REMOTE ORIGIN +############################ +git remote add origin https://github.com/username/Devops.git + +# Verify remote +git remote -v + + +############################ +# 1️⃣1️⃣ PUSH CODE TO GITHUB +############################ +git branch -M main +git push -u origin main + + +############################ +# 1️⃣2️⃣ CLONE A REPOSITORY +############################ +# git clone https://github.com/username/Devops.git + + +############################ +# 1️⃣3️⃣ CREATE A NEW BRANCH +############################ +git checkout -b feature-shell-script +# OR +# git branch feature-shell-script +# git checkout feature-shell-script + + +############################ +# 1️⃣4️⃣ MAKE CHANGES IN BRANCH +############################ +echo "Shell scripting basics" >> README.md +git add . +git commit -m "Added shell scripting info" + + +############################ +# 1️⃣5️⃣ PUSH BRANCH TO GITHUB +############################ +git push origin feature-shell-script + + +############################ +# 1️⃣6️⃣ CREATE PULL REQUEST (PR) +############################ +# Go to GitHub → Compare & Pull Request +# Add title and description → Create PR + + +############################ +# 1️⃣7️⃣ PULL LATEST CHANGES +############################ +git checkout main +git pull origin main + + +############################ +# 1️⃣8️⃣ GIT LOG (HISTORY) +############################ +git log --oneline + + +############################ +# 1️⃣9️⃣ GIT DIFF (CHANGES) +############################ +git diff + + +############################ +# 2️⃣0️⃣ DELETE A BRANCH +############################ +git branch -d feature-shell-script +git push origin --delete feature-shell-script + + +######################################################## +# ✅ END OF GIT & GITHUB LEVEL 1 +######################################################## diff --git a/level-2-git-github/projects/project-1-git-workflow/README.md b/level-2-git-github/projects/project-1-git-workflow/README.md new file mode 100644 index 0000000..64692e1 --- /dev/null +++ b/level-2-git-github/projects/project-1-git-workflow/README.md @@ -0,0 +1,147 @@ +############################################################ +# Project 1: Git & GitHub Workflow (Beginner) +# Path: +# projects/git-github/project-1-git-workflow/README.md +############################################################ + + +############################ +# 📌 Project Objective +############################ +# Understand and practice the basic Git and GitHub workflow +# used in real-world DevOps and open-source projects. +# +# This project helps you learn: +# - Git (version control) +# - GitHub (remote repository) +# - Collaboration using Pull Requests + + +############################ +# 🧠 Skills You Will Learn +############################ +# - git init +# - git add & git commit +# - git branch & checkout +# - git push & pull +# - Creating Pull Requests using GitHub GUI + + +############################ +# 🛠️ Prerequisites +############################ +# - Git installed on your system +# - GitHub account +# - Basic Linux command knowledge + + +############################ +# 📋 Project Tasks +############################ + + +############################ +# ✅ Task 1: Create Local Repository +############################ +mkdir git-workflow +cd git-workflow +git init + + +############################ +# ✅ Task 2: Create File and Commit +############################ +echo "My first Git project" > README.md +git add README.md +git commit -m "Initial commit" + + +############################ +# ✅ Task 3: Create GitHub Repository +############################ +# Steps (GUI): +# 1. Go to GitHub +# 2. Click New Repository +# 3. Repository name: git-workflow +# 4. Do NOT initialize with README +# 5. Click Create repository + + +############################ +# ✅ Task 4: Push Code to GitHub +############################ +git branch -M main +git remote add origin https://github.com//git-workflow.git +git push -u origin main + + +############################ +# ✅ Task 5: Create Feature Branch +############################ +git checkout -b feature-update-readme + + +############################ +# ✅ Task 6: Make Changes and Commit +############################ +echo "Learning Git branching" >> README.md +git add . +git commit -m "Update README with branch content" + + +############################ +# ✅ Task 7: Push Branch to GitHub +############################ +git push origin feature-update-readme + + +############################ +# ✅ Task 8: Create Pull Request (GUI) +############################ +# Steps: +# 1. Open GitHub repository +# 2. Click Compare & pull request +# 3. Add PR title and description +# 4. Click Create pull request + + +############################ +# ✅ Task 9: Merge Pull Request +############################ +# - Merge PR using GitHub UI +# - Delete branch after merge + + +############################ +# 🎯 Expected Outcome +############################ +# - Code successfully pushed to GitHub +# - Pull Request created and merged +# - Clear understanding of Git workflow + + +############################ +# 🌱 Real-World DevOps Use Case +############################ +# This workflow is used in: +# - CI/CD pipelines +# - Infrastructure as Code (IaC) +# - Team collaboration +# - Open-source contributions + + +############################ +# 🧪 Bonus Practice +############################ +# - Create another branch +# - Make conflicting changes +# - Practice resolving merge conflicts + + +############################ +# ✅ Project Status +############################ +# ✔ Beginner Friendly +# ✔ Hands-on +# ✔ DevOps Ready +############################################################