Skip to content

Commit 1700201

Browse files
Merge pull request #27 from teamgocodegit/main
Add Git Level 1 basics + Git workflow project
2 parents eb04e2e + 083d7b2 commit 1700201

2 files changed

Lines changed: 305 additions & 0 deletions

File tree

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/bin/bash
2+
3+
########################################################
4+
# 🚀 GIT & GITHUB – LEVEL 1 (BEGINNER)
5+
# This script explains basic Git + GitHub workflow
6+
# You can read, copy, and execute commands step by step
7+
########################################################
8+
9+
10+
############################
11+
# 1️⃣ CHECK GIT INSTALLATION
12+
############################
13+
git --version
14+
# If not installed (Ubuntu):
15+
# sudo apt install git -y
16+
17+
18+
############################
19+
# 2️⃣ CONFIGURE GIT (ONE TIME)
20+
############################
21+
git config --global user.name "Your Name"
22+
git config --global user.email "your-email@gmail.com"
23+
24+
# Verify config
25+
git config --list
26+
27+
28+
############################
29+
# 3️⃣ CREATE A PROJECT FOLDER
30+
############################
31+
mkdir Devops
32+
cd Devops
33+
34+
35+
############################
36+
# 4️⃣ INITIALIZE GIT REPO
37+
############################
38+
git init
39+
# Creates .git folder (Git starts tracking)
40+
41+
42+
############################
43+
# 5️⃣ CREATE A FILE
44+
############################
45+
echo "Hello DevOps" > README.md
46+
ls
47+
48+
49+
############################
50+
# 6️⃣ CHECK GIT STATUS
51+
############################
52+
git status
53+
# Shows untracked / modified files
54+
55+
56+
############################
57+
# 7️⃣ ADD FILES TO STAGING AREA
58+
############################
59+
git add README.md
60+
# OR add all files:
61+
# git add .
62+
63+
64+
############################
65+
# 8️⃣ COMMIT CHANGES
66+
############################
67+
git commit -m "Initial commit"
68+
# Saves snapshot to local repo
69+
70+
71+
############################
72+
# 9️⃣ CREATE GITHUB REPOSITORY
73+
############################
74+
# Go to GitHub → New Repository → Create repo (NO README)
75+
# Copy the repo URL
76+
77+
78+
############################
79+
# 🔟 ADD REMOTE ORIGIN
80+
############################
81+
git remote add origin https://github.com/username/Devops.git
82+
83+
# Verify remote
84+
git remote -v
85+
86+
87+
############################
88+
# 1️⃣1️⃣ PUSH CODE TO GITHUB
89+
############################
90+
git branch -M main
91+
git push -u origin main
92+
93+
94+
############################
95+
# 1️⃣2️⃣ CLONE A REPOSITORY
96+
############################
97+
# git clone https://github.com/username/Devops.git
98+
99+
100+
############################
101+
# 1️⃣3️⃣ CREATE A NEW BRANCH
102+
############################
103+
git checkout -b feature-shell-script
104+
# OR
105+
# git branch feature-shell-script
106+
# git checkout feature-shell-script
107+
108+
109+
############################
110+
# 1️⃣4️⃣ MAKE CHANGES IN BRANCH
111+
############################
112+
echo "Shell scripting basics" >> README.md
113+
git add .
114+
git commit -m "Added shell scripting info"
115+
116+
117+
############################
118+
# 1️⃣5️⃣ PUSH BRANCH TO GITHUB
119+
############################
120+
git push origin feature-shell-script
121+
122+
123+
############################
124+
# 1️⃣6️⃣ CREATE PULL REQUEST (PR)
125+
############################
126+
# Go to GitHub → Compare & Pull Request
127+
# Add title and description → Create PR
128+
129+
130+
############################
131+
# 1️⃣7️⃣ PULL LATEST CHANGES
132+
############################
133+
git checkout main
134+
git pull origin main
135+
136+
137+
############################
138+
# 1️⃣8️⃣ GIT LOG (HISTORY)
139+
############################
140+
git log --oneline
141+
142+
143+
############################
144+
# 1️⃣9️⃣ GIT DIFF (CHANGES)
145+
############################
146+
git diff
147+
148+
149+
############################
150+
# 2️⃣0️⃣ DELETE A BRANCH
151+
############################
152+
git branch -d feature-shell-script
153+
git push origin --delete feature-shell-script
154+
155+
156+
########################################################
157+
# ✅ END OF GIT & GITHUB LEVEL 1
158+
########################################################
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
############################################################
2+
# Project 1: Git & GitHub Workflow (Beginner)
3+
# Path:
4+
# projects/git-github/project-1-git-workflow/README.md
5+
############################################################
6+
7+
8+
############################
9+
# 📌 Project Objective
10+
############################
11+
# Understand and practice the basic Git and GitHub workflow
12+
# used in real-world DevOps and open-source projects.
13+
#
14+
# This project helps you learn:
15+
# - Git (version control)
16+
# - GitHub (remote repository)
17+
# - Collaboration using Pull Requests
18+
19+
20+
############################
21+
# 🧠 Skills You Will Learn
22+
############################
23+
# - git init
24+
# - git add & git commit
25+
# - git branch & checkout
26+
# - git push & pull
27+
# - Creating Pull Requests using GitHub GUI
28+
29+
30+
############################
31+
# 🛠️ Prerequisites
32+
############################
33+
# - Git installed on your system
34+
# - GitHub account
35+
# - Basic Linux command knowledge
36+
37+
38+
############################
39+
# 📋 Project Tasks
40+
############################
41+
42+
43+
############################
44+
# ✅ Task 1: Create Local Repository
45+
############################
46+
mkdir git-workflow
47+
cd git-workflow
48+
git init
49+
50+
51+
############################
52+
# ✅ Task 2: Create File and Commit
53+
############################
54+
echo "My first Git project" > README.md
55+
git add README.md
56+
git commit -m "Initial commit"
57+
58+
59+
############################
60+
# ✅ Task 3: Create GitHub Repository
61+
############################
62+
# Steps (GUI):
63+
# 1. Go to GitHub
64+
# 2. Click New Repository
65+
# 3. Repository name: git-workflow
66+
# 4. Do NOT initialize with README
67+
# 5. Click Create repository
68+
69+
70+
############################
71+
# ✅ Task 4: Push Code to GitHub
72+
############################
73+
git branch -M main
74+
git remote add origin https://github.com/<your-username>/git-workflow.git
75+
git push -u origin main
76+
77+
78+
############################
79+
# ✅ Task 5: Create Feature Branch
80+
############################
81+
git checkout -b feature-update-readme
82+
83+
84+
############################
85+
# ✅ Task 6: Make Changes and Commit
86+
############################
87+
echo "Learning Git branching" >> README.md
88+
git add .
89+
git commit -m "Update README with branch content"
90+
91+
92+
############################
93+
# ✅ Task 7: Push Branch to GitHub
94+
############################
95+
git push origin feature-update-readme
96+
97+
98+
############################
99+
# ✅ Task 8: Create Pull Request (GUI)
100+
############################
101+
# Steps:
102+
# 1. Open GitHub repository
103+
# 2. Click Compare & pull request
104+
# 3. Add PR title and description
105+
# 4. Click Create pull request
106+
107+
108+
############################
109+
# ✅ Task 9: Merge Pull Request
110+
############################
111+
# - Merge PR using GitHub UI
112+
# - Delete branch after merge
113+
114+
115+
############################
116+
# 🎯 Expected Outcome
117+
############################
118+
# - Code successfully pushed to GitHub
119+
# - Pull Request created and merged
120+
# - Clear understanding of Git workflow
121+
122+
123+
############################
124+
# 🌱 Real-World DevOps Use Case
125+
############################
126+
# This workflow is used in:
127+
# - CI/CD pipelines
128+
# - Infrastructure as Code (IaC)
129+
# - Team collaboration
130+
# - Open-source contributions
131+
132+
133+
############################
134+
# 🧪 Bonus Practice
135+
############################
136+
# - Create another branch
137+
# - Make conflicting changes
138+
# - Practice resolving merge conflicts
139+
140+
141+
############################
142+
# ✅ Project Status
143+
############################
144+
# ✔ Beginner Friendly
145+
# ✔ Hands-on
146+
# ✔ DevOps Ready
147+
############################################################

0 commit comments

Comments
 (0)