-
Notifications
You must be signed in to change notification settings - Fork 0
/
Git.json
1743 lines (1743 loc) · 129 KB
/
Git.json
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"range": "Git!A1:Z998",
"majorDimension": "ROWS",
"values": [
[
"Category",
"Subcategory",
"Weight",
"Is Starred?",
"Command",
"Description",
"More Info",
"Output"
],
[
"Commands",
"clone",
"0",
"Yes",
"git clone \u003crepository\u003e",
"Clone a repository into a new directory.",
"https://git-scm.com/docs/git-clone\nhttps://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository",
"$ git clone https://github.com/schacon/ticgit\nCloning into 'ticgit'...\nremote: Reusing existing pack: 1857, done.\nremote: Total 1857 (delta 0), reused 0 (delta 0)\nReceiving objects: 100% (1857/1857), 374.35 KiB | 268.00 KiB/s, done.\nResolving deltas: 100% (772/772), done.\nChecking connectivity... done."
],
[
"Commands",
"clone",
"10",
"No",
"git clone \u003crepository\u003e \u003cdirectory\u003e",
"Clone a repository into a new directory, and provide the directory name.",
"https://git-scm.com/docs/git-clone\nhttps://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository",
"$ git clone https://github.com/libgit2/libgit2 mylibgit"
],
[
"Commands",
"status",
"0",
"Yes",
"git status",
"Show the working tree status.",
"https://git-scm.com/docs/git-status\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nnothing to commit, working tree clean\n$ echo 'My Project' \u003e README\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nUntracked files:\n(use \"git add \u003cfile\u003e...\" to include in what will be committed)\nREADME\nnothing added to commit but untracked files present (use \"git add\" to track)\n$ git add README\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nChanges to be committed:\n(use \"git restore --staged \u003cfile\u003e...\" to unstage)\nnew file: README\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nChanges to be committed:\n(use \"git reset HEAD \u003cfile\u003e...\" to unstage)\nnew file: README\nChanges not staged for commit:\n(use \"git add \u003cfile\u003e...\" to update what will be committed)\n(use \"git checkout -- \u003cfile\u003e...\" to discard changes in working directory)\nmodified: CONTRIBUTING.md"
],
[
"Commands",
"status",
"10",
"No",
"git status --short",
"Show the working tree status in a shorter manner.\nTriggers: `-s`, `--short`\nNew files that aren’t tracked have a `??` next to them, new files that have been added to the staging area have an `A`, modified files have an `M` and so on. There are two columns to the output: The left-hand column indicates the status of the staging area and the right-hand column indicates the status of the working tree.",
"https://git-scm.com/docs/git-status\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git status -s\nM README\nMM Rakefile\nA lib/git.rb\nM lib/simplegit.rb\n?? LICENSE.txt"
],
[
"Commands",
"add",
"0",
"Yes",
"git add \u003cpath\u003e",
"Add file contents to the index.",
"https://git-scm.com/docs/git-add",
"$ git status\nOn branch master\nnothing to commit, working tree clean\n$ echo \"This is a README\" \u003e README\n$ git status\nOn branch master\nUntracked files:\n (use \"git add \u003cfile\u003e...\" to include in what will be committed)\n README\n\nnothing added to commit but untracked files present (use \"git add\" to track)\n$ git add README\n$ git status\nOn branch master\nChanges to be committed:\n (use \"git restore --staged \u003cfile\u003e...\" to unstage)\n new file: README"
],
[
"Commands",
"diff",
"0",
"Yes",
"git diff",
"Compare what's in the working directory with what's in the staging area.",
"https://git-scm.com/docs/git-diff\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git diff\ndiff --git a/CONTRIBUTING.md b/CONTRIBUTING.md\nindex 8ebb991..643e24f 100644\n--- a/CONTRIBUTING.md\n+++ b/CONTRIBUTING.md\n@@ -65,7 +65,8 @@ branch directly, things can get messy.\n Please include a nice description of your changes when you submit your PR;\n if we have to read the whole diff to figure out why you're contributing\n in the first place, you're less likely to get feedback and have your change\n-merged in.\n+merged in. Also, split your changes into comprehensive chunks if your patch is\n+longer than a dozen lines.\n\n If you are starting to work on a particular area, feel free to submit a PR\n that highlights your work in progress (and note in the PR title that it's"
],
[
"Commands",
"diff",
"10",
"Yes",
"git diff --staged",
"Compare what's in the staging area to the last commit.\n`--staged` and `--cached` are synonyms.",
"https://git-scm.com/docs/git-diff\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git diff --staged\ndiff --git a/README b/README\nnew file mode 100644\nindex 0000000..03902a1\n--- /dev/null\n+++ b/README\n@@ -0,0 +1 @@\n+My Project"
],
[
"Commands",
"commit",
"0",
"Yes",
"git commit",
"Record changes to the repository.",
"https://git-scm.com/docs/git-commit\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git commit"
],
[
"Commands",
"commit",
"10",
"Yes",
"git commit -m \"\u003cmessage\u003e\"",
"Record changes to the repository, provide commit message inline.",
"https://git-scm.com/docs/git-commit\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git commit -m \"Story 182: fix benchmarks for speed\"\n[master 463dc4f] Story 182: fix benchmarks for speed\n 2 files changed, 2 insertions(+)\n create mode 100644 README"
],
[
"Commands",
"commit",
"20",
"No",
"git commit -a -m \"\u003cmessage\u003e\"",
"Record changes to the repository and provide commit message inline while skipping staging area.",
"https://git-scm.com/docs/git-commit\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nChanges not staged for commit:\n(use \"git add \u003cfile\u003e...\" to update what will be committed)\n(use \"git checkout -- \u003cfile\u003e...\" to discard changes in working directory)\nmodified: CONTRIBUTING.md\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n$ git commit -a -m 'Add new benchmarks'\n[master 83e38c7] Add new benchmarks\n1 file changed, 5 insertions(+), 0 deletions(-)"
],
[
"Commands",
"rm",
"0",
"Yes",
"git rm \u003cpath\u003e",
"Remove a path from the working tree and from the index.",
"https://git-scm.com/docs/git-rm\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git rm PROJECTS.md\nrm 'PROJECTS.md'\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nChanges to be committed:\n(use \"git reset HEAD \u003cfile\u003e...\" to unstage)\ndeleted: PROJECTS.md\n$ git rm log/\\*.log\n$ git rm \\*~"
],
[
"Commands",
"rm",
"10",
"Yes",
"git rm --cached \u003cpath\u003e",
"Remove a path from the staging area while keeping it in the working tree.",
"https://git-scm.com/docs/git-rm\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git rm --cached README"
],
[
"Commands",
"mv",
"0",
"Yes",
"git mv \u003cfile_from\u003e \u003cfile_to\u003e",
"Move or rename a file, a directory, or a symlink.",
"https://git-scm.com/docs/git-mv\nhttps://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository",
"$ git mv README.md README\n$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nChanges to be committed:\n(use \"git reset HEAD \u003cfile\u003e...\" to unstage)\nrenamed: README.md -\u003e README"
],
[
"Commands",
"log",
"0",
"Yes",
"git log",
"Show commit logs.\n\nBy default, `git log` will only show commit history below the branch you’ve checked out.\n\nTo show commit history for the desired branch you have to explicitly specify it: `git log testing`. To show all of the branches, add `--all` to your git log command.\n",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log\ncommit ca82a6dff817ec66f44342007202690a93763949\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Mon Mar 17 21:52:11 2008 -0700\nChange version number\ncommit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Sat Mar 15 16:40:33 2008 -0700\nRemove unnecessary test\ncommit a11bef06a3f659402fe7563abf99ad00de2209e6\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Sat Mar 15 10:31:28 2008 -0700\nInitial commit"
],
[
"Commands",
"log",
"10",
"Yes",
"git log --patch",
"Show commit logs as diff.\n\nRecommended syntax: `git log -p -M --follow --stat -- path/to/file`",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History\nhttps://web.archive.org/web/20160515170215/http://blog.andrewray.me/a-better-git-blame/",
"$ git log -p -2\ncommit ca82a6dff817ec66f44342007202690a93763949\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Mon Mar 17 21:52:11 2008 -0700\nChange version number\ndiff --git a/Rakefile b/Rakefile\nindex a874b73..8f94139 100644\n--- a/Rakefile\n+++ b/Rakefile\n@@ -5,7 +5,7 @@ require 'rake/gempackagetask'\nspec = Gem::Specification.new do |s|\ns.platform = Gem::Platform::RUBY\ns.name = \"simplegit\"\n- s.version = \"0.1.0\"\n+ s.version = \"0.1.1\"\ns.author = \"Scott Chacon\"\ns.email = \"schacon@gee-mail.com\"\ns.summary = \"A simple gem for using Git in Ruby code.\"\ncommit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Sat Mar 15 16:40:33 2008 -0700\nRemove unnecessary test\ndiff --git a/lib/simplegit.rb b/lib/simplegit.rb\nindex a0a60ae..47c6340 100644\n--- a/lib/simplegit.rb\n+++ b/lib/simplegit.rb\n@@ -18,8 +18,3 @@ class SimpleGit\nend\nend\n-\n-if $0 == __FILE__\n- git = SimpleGit.new\n- puts git.show\n-end"
],
[
"Commands",
"log",
"20",
"No",
"git log -\u003cnumber\u003e",
"Show commit logs, limit the number of commits to output.\nTriggers: `-\u003cnumber\u003e`, `-n \u003cnumber\u003e`, `--max-count=\u003cnumber\u003e`",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log -3\ncommit ca82a6dff817ec66f44342007202690a93763949\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Mon Mar 17 21:52:11 2008 -0700\nChange version number\ncommit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Sat Mar 15 16:40:33 2008 -0700\nRemove unnecessary test\ncommit a11bef06a3f659402fe7563abf99ad00de2209e6\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Sat Mar 15 10:31:28 2008 -0700\nInitial commit"
],
[
"Commands",
"log",
"30",
"No",
"git log --pretty=\u003cformat\u003e",
"Show commit logs with special format.\nShortcut for `--pretty=oneline`: `--oneline`",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --pretty=oneline\nca82a6dff817ec66f44342007202690a93763949 Change version number\n085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7 Remove unnecessary test\na11bef06a3f659402fe7563abf99ad00de2209e6 Initial commit\n\n$ git log --pretty=format:\"%h - %an, %ar : %s\"\nca82a6d - Scott Chacon, 6 years ago : Change version number\n085bb3b - Scott Chacon, 6 years ago : Remove unnecessary test\na11bef0 - Scott Chacon, 6 years ago : Initial commit\n\n$ git log --pretty=fuller -1\ncommit 6c5e70b984a60b3cecd395edd5b48a7575bf58e0\nAuthor: Jessica Smith \u003cjessica@example.com\u003e\nAuthorDate: Sun Apr 6 10:17:23 2008 -0700\nCommit: Scott Chacon \u003cschacon@gmail.com\u003e\nCommitDate: Thu Apr 9 09:19:06 2009 -0700\n\n Add limit to log function\n\n Limit log functionality to the first 20"
],
[
"Commands",
"log",
"40",
"No",
"git log --graph",
"Show commit logs with ASCII branch graph.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --pretty=format:\"%h %s\" --graph\n* 2d3acf9 Ignore errors from SIGCHLD on trap\n* 5e3ee11 Merge branch 'master' of git://github.com/dustin/grit\n|\\\n| * 420eac9 Add method for getting the current branch\n* | 30e367c Timeout code and tests\n* | 5a09431 Add timeout protection to grit\n* | e1193f8 Support for heads with slashes in them\n|/\n* d6016bc Require time for xmlschema\n* 11d191e Merge branch 'defunkt' into local"
],
[
"Commands",
"log",
"50",
"No",
"git log --since=\u003cdate\u003e",
"Show commit logs since a specific date.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --since=2.weeks\n\n$ git log --since=\"2008-01-15\"\n\n$ git log --since=\"2 years 1 day 3 minutes ago\""
],
[
"Commands",
"log",
"60",
"No",
"git log --until=\u003cdate\u003e",
"Show commit logs until a specific date.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --until=2.weeks\n\n$ git log --until=\"2008-01-15\"\n\n$ git log --until=\"2 years 1 day 3 minutes ago\""
],
[
"Commands",
"log",
"70",
"No",
"git log --author=\u003cauthor\u003e",
"Show commit logs by a specific author.\n\nYou can specify more than one instance of the --author search criteria, which will limit the commit output to commits that match any of the --author patterns.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --author='Junio C Hamano'"
],
[
"Commands",
"log",
"80",
"No",
"git log --grep=\u003cpattern\u003e",
"Show commit logs containing keyword in the commit message.\n\nYou can specify more than one instance of `--grep` search criteria, which will limit the commit output to commits that match any of the `--grep` patterns; however, adding the --all-match option further limits the output to just those commits that match all `--grep` patterns.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --grep=\"Refactoring\""
],
[
"Commands",
"log",
"90",
"No",
"git log -S \u003cstring\u003e",
"Look for differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file.\n\nTakes a string and shows only those commits that changed the number of occurrences of that string.\n\nIf you need to be more specific, you can provide a regular expression to search for with the `-G` option.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History\nhttps://git-scm.com/book/en/v2/Git-Tools-Searching",
"$ git log -S function_name\n\n$ git log -S ZLIB_BUF_MAX --oneline\ne01503b zlib: allow feeding more than 4GB in one go\nef49a7a zlib: zlib can only process 4GB at a time"
],
[
"Commands",
"log",
"100",
"No",
"git log -- \u003cpath/to/file\u003e",
"Limit the log output to commits that introduced a change to the specified files.\n\nThis is always the last option and is generally preceded by double dashes (`--`) to separate the paths from the options",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log -- path/to/file"
],
[
"Commands",
"log",
"110",
"No",
"git log --no-merges",
"Show the whole commit history, but skip any merges.\n\n\nDepending on the workflow used in your repository, it’s possible that a sizable percentage of the commits in your log history are just merge commits, which typically aren’t very informative. To prevent the display of merge commits cluttering up your log history, simply add the log option `--no-merges`.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History",
"$ git log --no-merges"
],
[
"Commands",
"commit",
"30",
"Yes",
"git commit --amend",
"Redo the most recent commit, make the additional changes that were forgotten, stage them, and commit again.\n\nThis command takes your staging area and uses it for the commit. If you’ve made no changes since your last commit (for instance, you run this command immediately after your previous commit), then your snapshot will look exactly the same, and all you’ll change is your commit message.\nIt’s important to understand that when you’re amending your last commit, you’re not so much fixing it as replacing it entirely with a new, improved commit that pushes the old commit out of the way and puts the new commit in its place. Effectively, it’s as if the previous commit never happened, and it won’t show up in your repository history.\nThe obvious value to amending commits is to make minor improvements to your last commit, without cluttering your repository history with commit messages of the form, “Oops, forgot to add a file” or “Fixing a typo in last commit”.\nOnly amend commits that are still local and have not been pushed somewhere. Amending previously pushed commits and force pushing the branch will cause problems for your collaborators.",
"https://git-scm.com/docs/git-commit\nhttps://git-scm.com/book/en/v2/Git-Basics-Undoing-Things\nhttps://git-scm.com/book/en/v2/Git-Tools-Rewriting-History",
"$ git commit -m 'Initial commit'\n$ git add forgotten_file\n$ git commit --amend"
],
[
"Commands",
"reset",
"0",
"Yes",
"git reset HEAD \u003cfile\u003e...",
"Unstage a staged file.\n\nEssentially it just copies the file(s) from HEAD to the index, without modifying the working directory.\n\nGeneral form: `git reset \u003ccommit\u003e \u003cfile\u003e...`. \nIf no commit is provided, `HEAD` is assumed, so this is the same as `git reset \u003cfile\u003e...` (and essentially a shorthand for `git reset --mixed HEAD \u003cfile\u003e...`.\n\nConsider using `git restore` instead.",
"https://git-scm.com/docs/git-reset\nhttps://git-scm.com/book/en/v2/Git-Basics-Undoing-Things\nhttps://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified",
"$ git add *\n$ git status\nOn branch master\nChanges to be committed:\n(use \"git reset HEAD \u003cfile\u003e...\" to unstage)\nrenamed: README.md -\u003e README\nmodified: CONTRIBUTING.md\n$ git reset HEAD CONTRIBUTING.md\nUnstaged changes after reset:\nM CONTRIBUTING.md\n$ git status\nOn branch master\nChanges to be committed:\n(use \"git reset HEAD \u003cfile\u003e...\" to unstage)\nrenamed: README.md -\u003e README\nChanges not staged for commit:\n(use \"git add \u003cfile\u003e...\" to update what will be committed)\n(use \"git checkout -- \u003cfile\u003e...\" to discard changes in working directory)\nmodified: CONTRIBUTING.md\n\n$ git reset eb43bf file.txt"
],
[
"Commands",
"checkout",
"20",
"Yes",
"git checkout -- \u003cfile\u003e...",
"Revert a modified file.\n\nConsider using `git restore` instead.\n\nIt’s important to understand that `git checkout -- \u003cfile\u003e` is a dangerous command. Any local changes you made to that file are gone — Git just replaced that file with the last staged or committed version. Don’t ever use this command unless you absolutely know that you don’t want those unsaved local changes.",
"https://git-scm.com/docs/git-checkout\nhttps://git-scm.com/book/en/v2/Git-Basics-Undoing-Things",
"Changes not staged for commit:\n(use \"git add \u003cfile\u003e...\" to update what will be committed)\n(use \"git checkout -- \u003cfile\u003e...\" to discard changes in working directory)\nmodified: CONTRIBUTING.md\n$ git checkout -- CONTRIBUTING.md\n$ git status\nOn branch master\nChanges to be committed:\n(use \"git reset HEAD \u003cfile\u003e...\" to unstage)\nrenamed: README.md -\u003e README"
],
[
"Commands",
"restore",
"0",
"Yes",
"git restore --staged \u003cfile\u003e...",
"Unstage a staged file.",
"https://git-scm.com/docs/git-restore\nhttps://git-scm.com/book/en/v2/Git-Basics-Undoing-Things",
"$ git add *\n$ git status\nOn branch master\nChanges to be committed:\n(use \"git restore --staged \u003cfile\u003e...\" to unstage)\nmodified: CONTRIBUTING.md\nrenamed: README.md -\u003e README\n$ git restore --staged CONTRIBUTING.md\n$ git status\nOn branch master\nChanges to be committed:\n(use \"git restore --staged \u003cfile\u003e...\" to unstage)\nrenamed: README.md -\u003e README\nChanges not staged for commit:\n(use \"git add \u003cfile\u003e...\" to update what will be committed)\n(use \"git restore \u003cfile\u003e...\" to discard changes in working directory)\nmodified: CONTRIBUTING.md"
],
[
"Commands",
"restore",
"10",
"Yes",
"git restore \u003cfile\u003e...",
"Revert a modified file.\n\nIt’s important to understand that `git restore \u003cfile\u003e` is a dangerous command. Any local changes you made to that file are gone — Git just replaced that file with the last staged or committed version. Don’t ever use this command unless you absolutely know that you don’t want those unsaved local changes.",
"https://git-scm.com/docs/git-restore\nhttps://git-scm.com/book/en/v2/Git-Basics-Undoing-Things",
"Changes not staged for commit:\n(use \"git add \u003cfile\u003e...\" to update what will be committed)\n(use \"git restore \u003cfile\u003e...\" to discard changes in working directory)\nmodified: CONTRIBUTING.md\n$ git restore CONTRIBUTING.md\n$ git status\nOn branch master\nChanges to be committed:\n(use \"git restore --staged \u003cfile\u003e...\" to unstage)\nrenamed: README.md -\u003e README"
],
[
"Commands",
"remote",
"0",
"No",
"git remote",
"Show the remotes.",
"https://git-scm.com/docs/git-remote\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes",
"$ git remote\norigin\n\n$ git remote -v\norigin\thttps://github.com/schacon/ticgit (fetch)\norigin\thttps://github.com/schacon/ticgit (push)"
],
[
"Commands",
"remote",
"10",
"No",
"git remote add \u003cshortname\u003e \u003curl\u003e",
"Add a remote.",
"https://git-scm.com/docs/git-remote\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes",
"$ git remote\norigin\n$ git remote add pb https://github.com/paulboone/ticgit\n$ git remote -v\norigin\thttps://github.com/schacon/ticgit (fetch)\norigin\thttps://github.com/schacon/ticgit (push)\npb\thttps://github.com/paulboone/ticgit (fetch)\npb\thttps://github.com/paulboone/ticgit (push)"
],
[
"Commands",
"fetch",
"0",
"Yes",
"git fetch",
"Download objects and refs from another repository.\nNote that the `git fetch` command only downloads the data to your local repository — it doesn’t automatically merge it with any of your work or modify what you’re currently working on. You have to merge it manually into your work when you’re ready.",
"https://git-scm.com/docs/git-fetch\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes\nhttps://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1",
"$ git fetch"
],
[
"Commands",
"fetch",
"10",
"No",
"git fetch \u003cremote\u003e",
"Download objects and refs from another repository.",
"https://git-scm.com/docs/git-fetch\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches",
"$ git fetch pb\nremote: Counting objects: 43, done.\nremote: Compressing objects: 100% (36/36), done.\nremote: Total 43 (delta 10), reused 31 (delta 5)\nUnpacking objects: 100% (43/43), done.\nFrom https://github.com/paulboone/ticgit\n* [new branch] master -\u003e pb/master\n* [new branch] ticgit -\u003e pb/ticgit"
],
[
"Commands",
"pull",
"0",
"Yes",
"git pull",
"Fetch from and integrate with another repository or a local branch.\n\nEssentially this is a `git fetch` immediately followed by a `git merge` in most cases.",
"https://git-scm.com/docs/git-pull\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches\nhttps://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1",
"$ git pull"
],
[
"Commands",
"push",
"0",
"Yes",
"git push \u003cremote\u003e \u003cbranch\u003e",
"Upload local repository content to a remote repository.",
"https://git-scm.com/docs/git-push\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches",
"$ git push origin master"
],
[
"Commands",
"remote",
"20",
"No",
"git remote show \u003cremote\u003e",
"See more information about a particular remote.\n\nThis command shows which branch is automatically pushed to when you run `git push` while on certain branches. It also shows you which remote branches on the server you don’t yet have, which remote branches you have that have been removed from the server, and multiple local branches that are able to merge automatically with their remote-tracking branch when you run `git pull`.",
"https://git-scm.com/docs/git-remote\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes",
"$ git remote show origin\n* remote origin\nURL: https://github.com/my-org/complex-project\nFetch URL: https://github.com/my-org/complex-project\nPush URL: https://github.com/my-org/complex-project\nHEAD branch: master\nRemote branches:\nmaster tracked\ndev-branch tracked\nmarkdown-strip tracked\nissue-43 new (next fetch will store in remotes/origin)\nissue-45 new (next fetch will store in remotes/origin)\nrefs/remotes/origin/issue-11 stale (use 'git remote prune' to remove)\nLocal branches configured for 'git pull':\ndev-branch merges with remote dev-branch\nmaster merges with remote master\nLocal refs configured for 'git push':\ndev-branch pushes to dev-branch (up to date)\nmarkdown-strip pushes to markdown-strip (up to date)\nmaster pushes to master (up to date)"
],
[
"Commands",
"remote",
"30",
"No",
"git remote rename \u003cold\u003e \u003cnew\u003e",
"Rename a remote.",
"https://git-scm.com/docs/git-remote\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes",
"$ git remote rename pb paul\n$ git remote\norigin\npaul"
],
[
"Commands",
"remote",
"40",
"No",
"git remote remove \u003cremote\u003e",
"Remove a remote.\n\nOnce you delete the reference to a remote this way, all remote-tracking branches and configuration settings associated with that remote are also deleted.",
"https://git-scm.com/docs/git-remote\nhttps://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes",
"$ git remote remove paul\n$ git remote\norigin"
],
[
"Commands",
"tag",
"0",
"Yes",
"git tag",
"List existing tags.",
"https://git-scm.com/docs/git-tag\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git tag\nv1.0\nv2.0"
],
[
"Commands",
"tag",
"10",
"No",
"git tag -l \"\u003ctagname\u003e\"",
"List existing tags with filter.\nTriggers: `-l`, `--list`",
"https://git-scm.com/docs/git-tag\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git tag -l \"v1.8.5*\"\nv1.8.5\nv1.8.5-rc0\nv1.8.5-rc1\nv1.8.5-rc2\nv1.8.5-rc3\nv1.8.5.1\nv1.8.5.2\nv1.8.5.3\nv1.8.5.4\nv1.8.5.5"
],
[
"Commands",
"tag",
"20",
"No",
"git tag -a \u003ctagname\u003e -m \"\u003cmessage\u003e\"",
"Create an annotated tag.\n\nAnnotated tags are meant for release.\n\nThe `-m` specifies a tagging message, which is stored with the tag. If you don’t specify a message for an annotated tag, Git launches your editor so you can type it in.\n\nBy default, the `git push` command doesn’t transfer tags to remote servers, they need to be pushed explicitly (see `git push`).",
"https://git-scm.com/docs/git-tag\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git tag -a v1.4 -m \"my version 1.4\"\n$ git tag\nv0.1\nv1.3\nv1.4"
],
[
"Commands",
"show",
"0",
"No",
"git show \u003ctagname\u003e",
"Show details about a given tag.",
"https://git-scm.com/docs/git-show\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git show v1.4 # annotated\ntag v1.4\nTagger: Ben Straub \u003cben@straub.cc\u003e\nDate: Sat May 3 20:19:12 2014 -0700\nmy version 1.4\ncommit ca82a6dff817ec66f44342007202690a93763949\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Mon Mar 17 21:52:11 2008 -0700\nChange version number\n$ git show v1.4-lw # lightweight\ncommit ca82a6dff817ec66f44342007202690a93763949\nAuthor: Scott Chacon \u003cschacon@gee-mail.com\u003e\nDate: Mon Mar 17 21:52:11 2008 -0700\nChange version number"
],
[
"Commands",
"tag",
"30",
"No",
"git tag \u003ctagname\u003e",
"Create a lightweight tag.\n\nLightweight tags are meant for private or temporary object labels.\n\nBy default, the `git push` command doesn’t transfer tags to remote servers, they need to be pushed explicitly (see `git push`).",
"https://git-scm.com/docs/git-tag\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git tag v1.4-lw\n$ git tag\nv0.1\nv1.3\nv1.4\nv1.4-lw\nv1.5"
],
[
"Commands",
"tag",
"40",
"No",
"git tag -a \u003ctagname\u003e \u003ccommit_hash\u003e",
"Tag a specific commit.\n\nBy default, the `git push` command doesn’t transfer tags to remote servers, they need to be pushed explicitly (see `git push`).",
"https://git-scm.com/docs/git-tag\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git tag -a v1.2 9fceb02"
],
[
"Commands",
"push",
"10",
"No",
"git push \u003cremote\u003e \u003ctagname\u003e",
"Push a tag to a remote.\n\nBy default, the `git push` command doesn’t transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them.",
"https://git-scm.com/docs/git-push\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git push origin v1.5\nCounting objects: 14, done.\nDelta compression using up to 8 threads.\nCompressing objects: 100% (12/12), done.\nWriting objects: 100% (14/14), 2.05 KiB | 0 bytes/s, done.\nTotal 14 (delta 3), reused 0 (delta 0)\nTo git@github.com:schacon/simplegit.git\n* [new tag] v1.5 -\u003e v1.5"
],
[
"Commands",
"push",
"20",
"No",
"git push \u003cremote\u003e --tags",
"Push all tags to a remote.\n\nThis will transfer all of your tags to the remote server that are not already there.\n\n`git push \u003cremote\u003e --tags` will push both lightweight and annotated tags. There is currently no option to push only lightweight tags, but if you use `git push \u003cremote\u003e --follow-tags` only annotated tags will be pushed to the remote.",
"https://git-scm.com/docs/git-push\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git push origin --tags\nCounting objects: 1, done.\nWriting objects: 100% (1/1), 160 bytes | 0 bytes/s, done.\nTotal 1 (delta 0), reused 0 (delta 0)\nTo git@github.com:schacon/simplegit.git\n* [new tag] v1.4 -\u003e v1.4\n* [new tag] v1.4-lw -\u003e v1.4-lw"
],
[
"Commands",
"tag",
"50",
"No",
"git tag -d \u003ctagname\u003e",
"Delete a tag from the local repository.\n\nNote that this does not remove the tag from any remote servers. There are two common variations for deleting a tag from a remote server.",
"https://git-scm.com/docs/git-tag\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git tag -d v1.4-lw\nDeleted tag 'v1.4-lw' (was e7d5add)"
],
[
"Commands",
"push",
"30",
"No",
"git push \u003cremote\u003e --delete \u003ctagname\u003e",
"Delete a tag from the remote repository.",
"https://git-scm.com/docs/git-push\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git push origin --delete \u003ctagname\u003e"
],
[
"Commands",
"checkout",
"5",
"No",
"git checkout \u003ctagname\u003e",
"Checkout the versions of files a tag is pointing to.\nThis puts your repository in “detached HEAD” state. In this state, if you make changes and then create a commit, the tag will stay the same, but your new commit won’t belong to any branch and will be unreachable, except by the exact commit hash.",
"https://git-scm.com/docs/git-checkout\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git checkout v2.0.0\nNote: switching to 'v2.0.0'.\nYou are in 'detached HEAD' state. You can look around, make experimental\nchanges and commit them, and you can discard any commits you make in this\nstate without impacting any branches by performing another checkout.\nIf you want to create a new branch to retain commits you create, you may\ndo so (now or later) by using -c with the switch command. Example:\ngit switch -c \u003cnew-branch-name\u003e\nOr undo this operation with:\ngit switch -\nTurn off this advice by setting config variable advice.detachedHead to false\nHEAD is now at 99ada87... Merge pull request #89 from schacon/appendix-final\n$ git checkout v2.0-beta-0.1\nPrevious HEAD position was 99ada87... Merge pull request #89 from schacon/appendix-final\nHEAD is now at df3f601... Add atlas.json and cover image"
],
[
"Commands",
"checkout",
"20",
"No",
"git checkout -b \u003cbranchname\u003e \u003ctagname\u003e",
"Checkout the versions of files a tag is pointing to, while creating a branch.",
"https://git-scm.com/docs/git-checkout\nhttps://git-scm.com/book/en/v2/Git-Basics-Tagging",
"$ git checkout -b version2 v2.0.0\nSwitched to a new branch 'version2'"
],
[
"Commands",
"config",
"0",
"No",
"git config alias.\u003calias\u003e \u003ccommand\u003e",
"Create an alias for a command.\n\nTo run an external command, rather than a Git subcommand, start the command with a `!` character.",
"https://git-scm.com/docs/git-config\nhttps://git-scm.com/book/en/v2/Git-Basics-Git-Aliases",
"$ git config --global alias.co checkout\n$ git config --global alias.br branch\n$ git config --global alias.ci commit\n$ git config --global alias.st status\n$ git config --global alias.unstage 'reset HEAD --'\n$ git config --global alias.last 'log -1 HEAD'\n$ git config --global alias.visual '!gitk'"
],
[
"Commands",
"init",
"0",
"Yes",
"git init",
"Create an empty Git repository or reinitialize an existing one.",
"https://git-scm.com/docs/git-init\nhttps://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository",
"$ git init"
],
[
"Commands",
"branch",
"100",
"Yes",
"git branch \u003cbranchname\u003e",
"Create a new branch.\n\nThis creates a new pointer to the same commit you’re currently on (where `HEAD` is pointing to).",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell",
"$ git branch testing"
],
[
"Commands",
"log",
"120",
"No",
"git log --oneline --decorate",
"View the git log with extra info of where the branch pointers are pointing to.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell",
"$ git log --oneline --decorate\nf30ab (HEAD -\u003e master, testing) Add feature #32 - ability to add new formats to the central interface\n34ac2 Fix bug #1328 - stack overflow under certain conditions\n98ca9 Initial commit"
],
[
"Commands",
"checkout",
"0",
"Yes",
"git checkout \u003cbranchname\u003e",
"Switch to a given branch.\n\nThis moves HEAD to point to the given branch.\n\nRunning `git checkout [branch]` is pretty similar to running `git reset --hard [branch]` in that it updates all three trees for you to look like `[branch]`, but there are two important differences.\n\nFirst, unlike `reset --hard`, `checkout` is working-directory safe; it will check to make sure it’s not blowing away files that have changes to them. Actually, it’s a bit smarter than that — it tries to do a trivial merge in the working directory, so all of the files you haven’t changed will be updated. `reset --hard`, on the other hand, will simply replace everything across the board without checking.\n\nThe second important difference is how checkout updates `HEAD`. Whereas `reset` will move the branch that `HEAD` points to, checkout will move `HEAD` itself to point to another branch.",
"https://git-scm.com/docs/git-checkout\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell\nhttps://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified",
"$ git checkout testing\nSwitched to branch 'testing'"
],
[
"Commands",
"log",
"130",
"Yes",
"git log --oneline --decorate --graph --all",
"View the git log with extra info of where all the branch pointers are pointing to as a graph.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell",
"$ git log --oneline --decorate --graph --all\n* c2b9e (HEAD, master) Made other changes\n| * 87ab2 (testing) Made a change\n|/\n* f30ab Add feature #32 - ability to add new formats to the central interface\n* 34ac2 Fix bug #1328 - stack overflow under certain conditions\n* 98ca9 initial commit of my project"
],
[
"Commands",
"checkout",
"40",
"Yes",
"git checkout -b \u003cnewbranchname\u003e \u003cbranchname\u003e",
"Create a new branch and switch to it at the same time.\n\n`\u003cnewbranchname\u003e` is the new branch name, and it will initially point to the same commit as `\u003cbranch\u003e` does.",
"https://git-scm.com/docs/git-checkout\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches",
"$ commit 2146ea1844752535e52591d8d022448b5ec00090 (HEAD -\u003e master)\nAuthor: Dvd848 \u003cDvd848@users.noreply.github.com\u003e\nDate: Fri Aug 11 17:30:04 2023 +0300\n\n Update README\n$ git checkout -b feature master\nSwitched to a new branch 'feature'\n$ commit 2146ea1844752535e52591d8d022448b5ec00090 (HEAD -\u003e feature, master)\nAuthor: Dvd848 \u003cDvd848@users.noreply.github.com\u003e\nDate: Fri Aug 11 17:30:04 2023 +0300\n\n Update README"
],
[
"Commands",
"switch",
"0",
"Yes",
"git switch \u003cbranch\u003e",
"Switch to an existing branch.",
"https://git-scm.com/docs/git-switch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell"
],
[
"Commands",
"switch",
"10",
"No",
"git switch -c \u003cnewbranchname\u003e",
"Create a new branch and switch to it.\n\nTriggers: `-c`, `--create`\n",
"https://git-scm.com/docs/git-switch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell"
],
[
"Commands",
"switch",
"20",
"No",
"git switch -",
"Return to the previously checked out branch.",
"https://git-scm.com/docs/git-switch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell"
],
[
"Workflows",
"Branching",
"10",
"No",
"\u003cGetting interrupted with a higher priority fix\u003e",
"Getting interrupted with a higher priority fix.\n\n 1. Do some work on a website.\n 2. Create a branch for a new user story you’re working on.\n 3. Do some work in that branch.\n 4. Switch to your production branch.\n 5. Create a branch to add the hotfix.\n 6. After it’s tested, merge the hotfix branch, and push to production.\n 7. Switch back to your original user story and continue working.\n\n\nNote that if your working directory or staging area has uncommitted changes that conflict with the branch you’re checking out, Git won’t let you switch branches. It’s best to have a clean working state when you switch branches.",
"https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging",
"$ git checkout -b iss53\nSwitched to a new branch \"iss53\"\n$ vim index.html\n$ git commit -a -m 'Create new footer [issue 53]'\n$ git checkout master\nSwitched to branch 'master'\n$ git checkout -b hotfix\nSwitched to a new branch 'hotfix'\n$ vim index.html\n$ git commit -a -m 'Fix broken email address'\n[hotfix 1fb7853] Fix broken email address\n 1 file changed, 2 insertions(+)\n$ git checkout master\n$ git merge hotfix\nUpdating f42c576..3a0874c\nFast-forward\n index.html | 2 ++\n 1 file changed, 2 insertions(+)\n$ git branch -d hotfix\nDeleted branch hotfix (3a0874c).\n$ git checkout iss53\nSwitched to branch \"iss53\"\n$ vim index.html\n$ git commit -a -m 'Finish the new footer [issue 53]'\n[iss53 ad82d7a] Finish the new footer [issue 53]\n1 file changed, 1 insertion(+)\n$ git checkout master\nSwitched to branch 'master'\n$ git merge iss53\nMerge made by the 'recursive' strategy.\nindex.html | 1 +\n1 file changed, 1 insertion(+)\n$ git branch -d iss53"
],
[
"Commands",
"merge",
"0",
"Yes",
"git merge \u003cbranchname\u003e",
"Merge a branch into the current branch.",
"https://git-scm.com/docs/git-merge\nhttps://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches\nhttps://www.biteinteractive.com/understanding-git-merge/",
"$ git checkout master\n$ git log --oneline --decorate --graph --all\n* a00c2fa (dog) Add dog\n| * 9f3fae2 (cat) Add cat\n|/\n* 09f6706 (HEAD -\u003e master) Add animal class\n* 4e33f70 Add README\n* 4a5c59d Initial Commit\n$ git merge dog\nUpdating 09f6706..a00c2fa\nFast-forward\n script.py | 15 +++++++++++++--\n 1 file changed, 13 insertions(+), 2 deletions(-)\n$ git log --oneline --decorate --graph --all\n* a00c2fa (HEAD -\u003e master, dog) Add dog\n| * 9f3fae2 (cat) Add cat\n|/\n* 09f6706 Add animal class\n* 4e33f70 Add README\n* 4a5c59d Initial Commit\n\n$ git merge cat\nAuto-merging script.py\nCONFLICT (content): Merge conflict in script.py\nAutomatic merge failed; fix conflicts and then commit the result.\n$ # Fix conflicts...\n$ git add .\\script.py\n$ git merge --continue\n[master 11fb9a4] Merge branch 'cat'\n$ git log --oneline --decorate --graph --all\n* 11fb9a4 (HEAD -\u003e master) Merge branch 'cat'\n|\\\n| * 9f3fae2 (cat) Add cat\n* | a00c2fa (dog) Add dog\n|/\n* 09f6706 Add animal class\n* 4e33f70 Add README\n* 4a5c59d Initial Commit"
],
[
"Commands",
"branch",
"110",
"Yes",
"git branch -d \u003cbranchname\u003e",
"Delete a branch.\n\nNote: If the branch contains work that wasn't merged yet, git might refuse to delete the branch.\nTo force it, use `-D` instead.\n",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging",
"$ git branch -d hotfix\nDeleted branch hotfix (3a0874c)."
],
[
"Workflows",
"Branching",
"20",
"No",
"\u003cMerging conflicts\u003e",
"Merging conflicts.\n\n 1. Attempt to merge the branches\n 2. Identify that git complains about conflicts\n 3. Resolve the conflicts\n 4. Add each file back to the staging area to mark the conflict resolved\n 5. Check status to confirm no conflicts remain\n 6. Commit change\n",
"https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging\nhttps://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1",
"$ git merge iss53\nAuto-merging index.html\nCONFLICT (content): Merge conflict in index.html\nAutomatic merge failed; fix conflicts and then commit the result.\n$ git status\nOn branch master\nYou have unmerged paths.\n (fix conflicts and run \"git commit\")\n\nUnmerged paths:\n (use \"git add \u003cfile\u003e...\" to mark resolution)\n\n both modified: index.html\n\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\n$ # Resolve conflicts (perhaps by running git mergetool)\n$ git add index.html\n\n$ git status\nOn branch master\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\n modified: index.html\n$ git commit\nMerge branch 'iss53'\n\nConflicts:\n index.html\n#\n# It looks like you may be committing a merge.\n# If this is not correct, please remove the file\n#\t.git/MERGE_HEAD\n# and try again.\n\n\n# Please enter the commit message for your changes. Lines starting\n# with '#' will be ignored, and an empty message aborts the commit.\n# On branch master\n# All conflicts fixed but you are still merging.\n#\n# Changes to be committed:\n#\tmodified: index.html\n#\n"
],
[
"Commands",
"mergetool",
"0",
"No",
"git mergetool",
"Run merge conflict resolution tools to resolve merge conflicts.",
"https://git-scm.com/docs/git-mergetool\nhttps://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging"
],
[
"Workflows",
"Branching",
"0",
"No",
"\u003cSimple fix\u003e",
"A simple fix.\n 1. Create a branch for the fix\n 2. Fix the issue\n 3. Merge the fix to the main branch\n 4. Delete the branch\n",
"https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging\nhttps://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1",
"$ git checkout -b iss53\nSwitched to a new branch \"iss53\"\n$ vim index.html\n$ git commit -a -m 'Create new footer [issue 53]'\n$ git checkout master\nSwitched to branch 'master'\n$ git merge iss53\nMerge made by the 'recursive' strategy.\nindex.html | 1 +\n1 file changed, 1 insertion(+)\n$ git branch -d iss53"
],
[
"Commands",
"branch",
"0",
"Yes",
"git branch",
"View existing branches.\n\nThe `*` indicates the branch that you currently have checked out (i.e., the branch that `HEAD` points to).\n",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch\n iss53\n* master\n testing"
],
[
"Commands",
"branch",
"10",
"No",
"git branch -v",
"View the last commit on each branch.",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch -v\n iss53 93b412c Fix javascript issue\n* master 7a98805 Merge branch 'iss53'\n testing 782fd34 Add scott to the author list in the readme"
],
[
"Commands",
"branch",
"20",
"No",
"git branch --merged",
"View only the branches that you have merged into the branch you’re currently on.",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch --merged\n iss53\n* master"
],
[
"Commands",
"branch",
"30",
"No",
"git branch --no-merged",
"View only the branches that you have not merged into the branch you’re currently on.",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch --no-merged\n testing"
],
[
"Commands",
"branch",
"111",
"Yes",
"git branch -D \u003cbranchname\u003e",
"Force-delete a branch.\n\nThis might be needed if the branch contains work that has not yet been merged.\nShortcut for `--delete --force`\n",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch -d testing\nerror: The branch 'testing' is not fully merged.\nIf you are sure you want to delete it, run 'git branch -D testing'.\n$ git branch -D testing"
],
[
"Commands",
"branch",
"21",
"No",
"git branch --merged \u003cbranchname\u003e",
"View only the branches that you have merged into the provided branch.",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git checkout testing\n$ git branch --merged master\n topicA\n featureB"
],
[
"Commands",
"branch",
"31",
"No",
"git branch --no-merged \u003cbranchname\u003e",
"View only the branches that you have not merged into the provided branch.",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git checkout testing\n$ git branch --no-merged master\n topicA\n featureB"
],
[
"Commands",
"branch",
"40",
"No",
"git branch --move \u003coldname\u003e \u003cnewname\u003e",
"Rename a branch locally.\n\nCollaborators won't see the change until the branch is pushed upstream using:\n`git push --set-upstream \u003cremote\u003e \u003cnewname\u003e`\n",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch --move bad-branch-name corrected-branch-name\n"
],
[
"Workflows",
"Branching",
"30",
"No",
"\u003cRename a branch remotely\u003e",
"Rename a branch remotely.\n 1. Rename the branch locally\n 2. Push the new branch upstream\n 3. Delete the old branch from the remote\n\nDo not rename branches that are still in use by other collaborators. Do not rename a branch like master/main/mainline without further research.\n",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Branch-Management",
"$ git branch --move bad-branch-name corrected-branch-name\n$ git push --set-upstream origin corrected-branch-name\n$ git branch --all\n* corrected-branch-name\n main\n remotes/origin/bad-branch-name\n remotes/origin/corrected-branch-name\n remotes/origin/main\n$ git push origin --delete bad-branch-name\n"
],
[
"Commands",
"config",
"0",
"No",
"git config --global credential.helper cache",
"Setup a credential cache to avoid retyping password.",
"https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches\nhttps://git-scm.com/book/en/v2/ch00/_credential_caching"
],
[
"Commands",
"checkout",
"50",
"No",
"git checkout --track \u003cremote\u003e/\u003cbranch\u003e",
"Setup a local tracking branch for the remote branch.",
"https://git-scm.com/docs/git-checkout\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches",
"$ git checkout --track origin/serverfix\nBranch serverfix set up to track remote branch serverfix from origin.\nSwitched to a new branch 'serverfix'"
],
[
"Commands",
"branch",
"11",
"No",
"git branch -vv",
"List out local branches with more information.\n\nThis information includes what each branch is tracking and if your local branch is ahead, behind or both",
"https://git-scm.com/docs/git-branch\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches",
"$ git branch -vv\n iss53 7e424c3 [origin/iss53: ahead 2] Add forgotten brackets\n master 1ae2a45 [origin/master] Deploy index fix\n* serverfix f8674d9 [teamone/server-fix-good: ahead 3, behind 1] This should do it\n testing 5ea463a Try something new"
],
[
"Commands",
"push",
"40",
"No",
"git push \u003cremote\u003e --delete \u003cbranch\u003e",
"Delete a remote branch.",
"https://git-scm.com/docs/git-push\nhttps://git-scm.com/book/en/v2/Git-Branching-Remote-Branches",
"$ git push origin --delete serverfix\nTo https://github.com/schacon/simplegit\n - [deleted] serverfix"
],
[
"Commands",
"rebase",
"0",
"Yes",
"git rebase \u003cbranch\u003e",
"Take all the changes that were committed on the given branch and replay them on the current branch.",
"https://git-scm.com/docs/git-rebase\nhttps://git-scm.com/book/en/v2/Git-Branching-Rebasing\nhttps://git-rebase.io/",
"$ git checkout experiment\n$ git rebase master\nFirst, rewinding head to replay your work on top of it...\nApplying: added staged command"
],
[
"Workflows",
"Branching",
"40",
"No",
"\u003cBasic rebase\u003e",
"Basic rebase.\n\n 1. Checkout the topic branch and rebase it onto the main branch\n 2. Return to the main branch and perform a fast-forward merge\n",
"https://git-scm.com/book/en/v2/Git-Branching-Rebasing\nhttps://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1",
"$ git checkout experiment\n$ git rebase master\nFirst, rewinding head to replay your work on top of it...\nApplying: added staged command\n$ git checkout master\n$ git merge experiment"
],
[
"Commands",
"rebase",
"10",
"No",
"git rebase --onto \u003cnewbase\u003e \u003cupstream\u003e \u003cbranch\u003e",
"Perform a rebase from a given starting point.\n\nThis basically means: \"Take the `branch` branch, figure out the patches since it diverged from the `upstream` branch, and replay these patches in the `branch` branch as if it was based directly off the `newbase` branch instead\".",
"https://git-scm.com/book/en/v2/Git-Branching-Rebasing\nhttps://git-rebase.io/",
"$ git rebase --onto master server client"
],
[
"Commands",
"rebase",
"20",
"No",
"git rebase \u003cbasebranch\u003e \u003ctopicbranch\u003e",
"Check out the topic branch and replay it onto the base branch.",
"https://git-scm.com/book/en/v2/Git-Branching-Rebasing\nhttps://git-rebase.io/",
"$ git rebase master server"
],
[
"Commands",
"pull",
"10",
"Yes",
"git pull --rebase",
"Rrebase the current branch on top of the upstream branch after fetching.",
"https://git-scm.com/docs/git-pull\nhttps://git-scm.com/book/en/v2/Git-Branching-Rebasing",
"$ git pull --rebase"
],
[
"Commands",
"config",
"20",
"No",
"git config --global pull.rebase true",
"Configure git pull to always use a rebase.",
"https://git-scm.com/docs/git-pull\nhttps://git-scm.com/book/en/v2/Git-Branching-Rebasing"
],
[
"Commands",
"diff",
"20",
"No",
"git diff --check",
"Warn if changes introduce conflict markers or whitespace errors.",
"https://git-scm.com/docs/git-diff\nhttps://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project"
],
[
"Commands",
"push",
"50",
"Yes",
"git push -u \u003cremote\u003e \u003cbranch\u003e",
"Push a local branch upstream.\n\nTriggers: `-u`, `--set-upstream`.\n\nThis configures the branches for easier pushing and pulling later.",
"https://git-scm.com/docs/git-push\nhttps://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project",
"$ git push -u origin featureA\n...\nTo jessica@githost:simplegit.git\n * [new branch] featureA -\u003e featureA"
],
[
"Commands",
"merge",
"10",
"No",
"git merge --squash \u003cbranch\u003e",
"Merge a branch into the current branch, squash all commits into one. \n\nDoes not auto-commit! You must commit manually.\n\nThis option takes all the work on the merged branch and squashes it into one changeset producing the repository state as if a real merge happened, without actually making a merge commit. This means your future commit will have one parent only and allows you to introduce all the changes from another branch and then make more changes before recording the new commit.",
"https://git-scm.com/docs/git-merge\nhttps://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project",
"$ git checkout -b featureBv2 origin/master\n$ git merge --squash featureB\n ... change implementation ...\n$ git commit\n$ git push myfork featureBv2"
],
[
"Commands",
"apply",
"0",
"No",
"git apply \u003cpatchfile\u003e",
"Apply a patch file.\n\nIf you received the patch from someone who generated it with `git diff` or some variation of the Unix `diff` command (which is not recommended; use `format-patch` instead), you can apply it with the `git apply` command.",
"https://git-scm.com/docs/git-apply\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project",
"$ git apply /tmp/patch-ruby-client.patch\n"
],
[
"Commands",
"apply",
"10",
"No",
"git apply --check \u003cpatchfile\u003e",
"Check if a patch applies cleanly before you try actually applying it.\n\nIf there is no output, then the patch should apply cleanly. This command also exits with a non-zero status if the check fails, so you can use it in scripts if you want.",
"https://git-scm.com/docs/git-apply\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project",
"$ git apply --check 0001-see-if-this-helps-the-gem.patch\nerror: patch failed: ticgit.gemspec:1\nerror: ticgit.gemspec: patch does not apply"
],
[
"Commands",
"am",
"0",
"No",
"git am \u003cpatchfile\u003e",
"Apply a patch file generated by format-patch.",
"https://git-scm.com/docs/git-am\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project",
"$ git am 0001-limit-log-function.patch\nApplying: Add limit to log function"
],
[
"Commands",
"format-patch",
"0",
"No",
"git format-patch",
"Prepare patches for e-mail submission.\n",
"https://git-scm.com/docs/git-format-patch\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project"
],
[
"Workflows",
"Patches",
"0",
"No",
"\u003cApply a patch with conflicts\u003e",
"Apply a patch with conflicts\n 1. Attempt to apply the patch\n 2. Observe conflicts\n 3. Resolve conflicts\n 4. Add the conflicted file(s) back\n 5. Resume applying the patch\n",
"https://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project",
"$ git am 0001-see-if-this-helps-the-gem.patch\nApplying: See if this helps the gem\nerror: patch failed: ticgit.gemspec:1\nerror: ticgit.gemspec: patch does not apply\nPatch failed at 0001.\nWhen you have resolved this problem run \"git am --resolved\".\nIf you would prefer to skip this patch, instead run \"git am --skip\".\nTo restore the original branch and stop patching run \"git am --abort\".\n\n$ (fix the file)\n$ git add ticgit.gemspec\n$ git am --resolved\nApplying: See if this helps the gem"
],
[
"Commands",
"log",
"140",
"No",
"git log \u003cbranch1\u003e --not \u003cbranch2\u003e",
"See all the commits in branch1 which aren't in branch2.\n\nThis syntax allows specify more than two references in your query. For instance, if you want to see all commits that are reachable from `refA` or `refB` but not from `refC`:\n`git log refA refB --not refC`.\n\nThe following three commands are equivalent:\n\n * `$ git log refA..refB`\n * `$ git log ^refA refB`\n * `$ git log refB --not refA`",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project\nhttps://git-scm.com/book/en/v2/Git-Tools-Revision-Selection",
"$ git log contrib --not master\ncommit 5b6235bd297351589efc4d73316f0a68d484f118\nAuthor: Scott Chacon \u003cschacon@gmail.com\u003e\nDate: Fri Oct 24 09:53:59 2008 -0700\n\n See if this helps the gem\n\ncommit 7482e0d16d04bea79d0dba8988cc78df655f16a0\nAuthor: Scott Chacon \u003cschacon@gmail.com\u003e\nDate: Mon Oct 22 19:38:36 2008 -0700\n\n Update gemspec to hopefully work better\n\n$ git log refA refB --not refC"
],
[
"Commands",
"log",
"150",
"No",
"git log \u003cbranch1\u003e..\u003cbranch2\u003e",
"See all the commits in branch2 which aren't in branch1.\n\nYou can also leave off one side of the syntax to have Git assume `HEAD`.\n\nThe following three commands are equivalent:\n\n * `$ git log refA..refB`\n * `$ git log ^refA refB`\n * `$ git log refB --not refA`",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project\nhttps://git-scm.com/book/en/v2/Git-Tools-Revision-Selection",
"$ git log --no-merges issue54..origin/master\ncommit 738ee872852dfaa9d6634e0dea7a324040193016\nAuthor: John Smith \u003cjsmith@example.com\u003e\nDate: Fri May 29 16:01:27 2009 -0700\n\n Remove invalid default value\n\n$ git log origin/master..HEAD"
],
[
"Commands",
"merge-base",
"0",
"No",
"git merge-base \u003cbranch1\u003e \u003cbranch2\u003e",
"Find as good common ancestors as possible for a merge.",
"https://git-scm.com/docs/git-merge-base\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project",
"$ git merge-base contrib master\n36c7dba2c95e6bbb78dfa822519ecfec6e1ca649"
],
[
"Commands",
"diff",
"160",
"Yes",
"git diff \u003cbranch1\u003e...\u003cbranch2\u003e\n",
"See only the work that branch2 has introduced since its common ancestor with branch1.\n\nIn other words, this specifies all the commits that are reachable by either of two references but not by both of them.",
"https://git-scm.com/docs/git-log\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project\nhttps://git-scm.com/book/en/v2/Git-Tools-Revision-Selection",
"$ git diff master...contrib\n"
],
[
"Commands",
"cherry-pick",
"0",
"Yes",
"git cherry-pick \u003ccommit\u003e",
"Apply the changes introduced by some existing commits.\n\nThis pulls the same change introduced in `\u003ccommit\u003e`, but you get a new commit SHA-1 value, because the date applied is different.\n\nAdd `-x` to include a comment listing the original commit ID.",
"https://git-scm.com/docs/git-cherry-pick\nhttps://git-scm.com/book/en/v2/Distributed-Git-Maintaining-a-Project\nhttps://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1",
"$ git cherry-pick e43a6\nFinished one cherry-pick.\n[master]: created a0a41a9: \"More friendly message when locking the index fails.\"\n 3 files changed, 17 insertions(+), 3 deletions(-)"
],
[
"Commands",
"config",
"30",