forked from iamdevdhanush/Devops
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.md
More file actions
158 lines (113 loc) · 3.43 KB
/
README.md
File metadata and controls
158 lines (113 loc) · 3.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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
########################################################