-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitcommand.txt
202 lines (76 loc) · 3.4 KB
/
gitcommand.txt
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
git tutorials by code with harry
https://www.youtube.com/playlist?list=PLu0W_9lII9ahVQekD7ePHmnirTePXwIln
git status
to check status of a folder
git add .
to stage a file
git commit -m "Version 1"
to commit a folder
git log
to check which commits were done by which editors
git config --global user.name "Meet Jain"
to change name for whole computer all reposiory
git config user.name "Meet Jain"
to change name for a particular repository
git config --global user.name
to see what name is used globally means in all repositories
git config --global user.email "Meet Jain"
to change email for whole computer all reposiory
git config user.email "Meet Jain"
to change email for a particular repository
git config --global user.email
to see what email is used globally means in all repositories
git remote add origin [email protected]:MJ665/gitTutorials.git
to add ssh key in our git folder
git push -u origin master
to push code in online repository
git pull origin
to see what were changes made by other users we will do git pull request
first do a stage file then do if any changes are made and to compare those changes
git diff
to compare changes between stage file and original file
git reset 1234.txt
to restore change back to staged file
git checkout
to reset a file
git add -A----->stage all
git add .-------->stage new and modified without delete--->means
if i have created 1 old file and created one new file and deleted one file then it will not get stage and other 2 files weather they are new or old will get stage
if i have deleted one file then it would be deleted from code also
git add -u------->small u stage new and modified without new------>means
in a floder in 2 old file i have made changes and i have created 1 new file then it will not stage 1 new file and remaining all file will come to stage
touch .gitignore
makes a .gitignore file this is a hidden file
ls - la
to check which files exist
notepad .gitignore
if you are in windows do
open .gitignore
but if you are in mac os do
basic terminal commands
Open up terminal, cmd + space "terminal".
pwd Figure out which directory you are currently in by "Printing the Working Directory".
ls List the directories and files inside the current directory.
ls -a include hidden files in the list of directories and files. This is helpful when trying to find hidden files like .git or .gitignore
cd [folder] Go into the folder. e.g. cd Desktop/Developer
cd This by itself will navigate all the way out to your Home Directory
cd .. Back out to the parent directory of the current directory.
open [file] Same as "double-clicking" a file or folder in finder.
open . Opens the current folder or file in finder or it's default application.
clear When you need a fresh Terminal window
if i want to ignore a cretain file which i wass tracking in past then i would creat a git ignore file and pul all the name of files in it
git branch
to see which branches are there in computers git repository
git branch master2
this will creat new branch with name master2
git checkout master2
to switch to a new branch in computer
git push -u origin master2
to push on github internet
to creat if not existing or push if exting
git merge master2
to merge master2 branch to master branch
git branch -d master2
to delete branch in computer
git push origin --delete master2
to delete branch on github