@@ -6,10 +6,11 @@ This Repository is a guide to all the git commands you need to use in case any o
6
6
* [ Basic Commands :v : ] ( #basic-commands-v )
7
7
* [ Branches :deciduous_tree : ] ( #branches-deciduous_tree )
8
8
* [ Update forked Repository with original Repository :hourglass : ] ( #update-forked-repository-with-original-repository--hourglass )
9
- * [ Dev branch is X commits behind and Y commits ahead of master] ( #your-dev-branch-is-x-commits-behind-and-y-commits-ahead-of-master-fix )
9
+ * [ Dev branch is X commits behind and Y commits ahead of main] ( #your-dev-branch-is-x-commits-behind-and-y-commits-ahead-of-main-fix )
10
+ * [ Reverting Commits :sunglasses : ] ( #reverting-commits-sunglasses )
10
11
* [ Short hands] ( #short-hands )
11
12
* [ GitHub CLI commands] ( #github--cli-commands )
12
- * [ Reverting Commits : sunglasses : ] ( #reverting -commits-sunglasses )
13
+ * [ Signing Commits] ( #signing -commits )
13
14
14
15
15
16
## Basic Commands :v :
@@ -37,7 +38,7 @@ git clone https://github.com/CodeChefVIT/git-cheatsheet.git
37
38
38
39
git add .
39
40
git commit -m < commit message>
40
- git push origin master
41
+ git push origin main
41
42
42
43
To add just one file or a set of files replace the . with your filename in first command
43
44
@@ -189,42 +190,42 @@ now, when you add the files it ignores node_modules directory in your project.
189
190
190
191
Use the following if you want to rebase your branch:
191
192
```
192
- git rebase upstream/master
193
+ git rebase upstream/main
193
194
```
194
195
195
196
Or use the merge command if you want to merge instead:
196
197
```
197
- git merge upstream/master
198
+ git merge upstream/main
198
199
```
199
200
200
- Replace "master " with the name of the branch on the forked repository that you want to rebase or merge with.
201
+ Replace "main " with the name of the branch on the forked repository that you want to rebase or merge with.
201
202
202
203
** [ ⬆ Back to Index] ( #index-books ) **
203
204
204
- ## Your dev branch is X commits behind and Y commits ahead of master fix
205
+ ## Your dev branch is X commits behind and Y commits ahead of main fix
205
206
206
207
``` sh
207
- git checkout master
208
+ git checkout main
208
209
209
- git fetch origin master
210
+ git fetch origin main
210
211
211
212
git checkout dev
212
213
213
- git rebase origin/master
214
+ git rebase origin/main
214
215
215
- git checkout master
216
+ git checkout main
216
217
217
218
git merge --no-ff dev
218
219
219
220
If you get this message ' Automatic merge failed; fix conflicts and then commit the result'
220
221
221
- Check for merge conflicts in code and fix them (master branch should have required files now)
222
+ Check for merge conflicts in code and fix them (main branch should have required files now)
222
223
223
224
For any such message deleted in ' dev and modified in HEAD. Version HEAD of requirements.txt left in tree'
224
225
225
226
File can either be deleted or modified or kept same
226
227
227
- git pull origin master (if warning comes)
228
+ git pull origin main (if warning comes)
228
229
229
230
add , commit , push
230
231
@@ -338,3 +339,13 @@ Create a shortcut for a gh command.
338
339
` ` `
339
340
340
341
** [⬆ Back to Index](# index-books)**
342
+
343
+ # # Signing Commits
344
+ These steps are to be followed when you want to sign your current commit.
345
+ ` ` ` sh
346
+ git commit --ammend --signoff
347
+ for signing the current commit
348
+ git push -f
349
+ force pushes the changes to the current branch.
350
+ ` ` `
351
+ ** [⬆ Back to Index](# index-books)**
0 commit comments