summaryrefslogtreecommitdiff
path: root/Documentation/magit.texi
blob: 03076513aba65947c7795f0fca579ff9537f4f66 (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
\input texinfo    @c -*- texinfo -*-
@c %**start of header
@setfilename ./magit.info
@settitle Magit User Manual
@documentencoding UTF-8
@documentlanguage en
@c %**end of header

@copying
@ifnottex
Magit is an interface to the version control system Git, implemented
as an Emacs package.  Magit aspires to be a complete Git porcelain.
While we cannot (yet) claim that Magit wraps and improves upon each
and every Git command, it is complete enough to allow even experienced
Git users to perform almost all of their daily version control tasks
directly from within Emacs.  While many fine Git clients exist, only
Magit and Git itself deserve to be called porcelains.
@end ifnottex

@quotation
Copyright (C) 2015 Jonas Bernoulli <jonas@@bernoul.li>

You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any
later version.

This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.
@end quotation
@end copying

@dircategory Emacs
@direntry
* Magit: (magit).       Using Git from Emacs with Magit.
@end direntry

@finalout
@titlepage
@title Magit User Manual
@subtitle for version 2.1
@author Jonas Bernoulli
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage

@contents

@ifnottex
@node Top
@top Magit User Manual
@insertcopying
@end ifnottex


@menu
* Introduction::
* Installation::
* Getting started::
* Interface concepts::
* Inspecting::
* Manipulating::
* Transferring::
* Miscellaneous::
* Customizing::
* Plumbing::
* FAQ::
* Keystroke Index::
* Command Index::
* Function Index::
* Variable Index::

@detailmenu
--- The Detailed Node Listing ---

Installation

* Updating from an older release::
* Installing from an Elpa archive::
* Installing from the Git repository::
* Post-installation tasks::

Interface concepts

* Modes and Buffers::
* Automatic save::
* Automatic refresh and revert::
* Sections::
* Popup buffers and prefix commands::
* Completion and confirmation::
* Running Git::

Sections

* Section movement::
* Section visibility::
* Section hooks::
* Section types and values::
* Section options::

Running Git

* Viewing Git output::
* Running Git manually::
* Git executable::
* Global Git arguments::

Inspecting

* Status buffer::
* Logging::
* Diffing::
* Ediffing::
* References buffer::
* Bisecting::
* Visiting blobs::
* Blaming::

Status buffer

* Status sections::
* Status header sections::
* Status options::

Logging

* Log Buffer::
* Select from log::
* Reflog::

Diffing

* Refreshing diffs::
* Diff buffer::
* Diff options::
* Revision buffer::

References buffer

* References sections::

Manipulating

* Repository setup::
* Staging and unstaging::
* Applying::
* Committing::
* Branching::
* Merging::
* Rebasing::
* Cherry picking::
* Resetting::
* Stashing::

Staging and unstaging

* Staging from file-visiting buffers::

Committing

* Initiating a commit::
* Editing commit messages::

Rebasing

* Editing rebase sequences::

Cherry picking

* Reverting::

Transferring

* Remotes::
* Fetching::
* Pulling::
* Pushing::
* Creating and sending patches::
* Applying patches::

Miscellaneous

* Tagging::
* Notes::
* Submodules::
* Wip Modes::

Customizing

* Per-repository configuration::
* Essential settings::

Essential settings

* Safety::
* Performance::

Plumbing

* Calling Git::
* Section plumbing::
* Refreshing buffers::
* Conventions::

Calling Git

* Getting a value from Git::
* Calling Git for effect::

Section plumbing

* Creating sections::
* Section selection::
* Matching sections::

Conventions

* Confirmation and completion::
* Theming Faces::

FAQ

* Magit is slow::
* I am having problems committing::
* I am using an Emacs release older than 24.4: I am using an Emacs release older than 244. 
* I am using a Git release older than 1.9.4: I am using a Git release older than 194. 
* I am using MS Windows and cannot push with Magit::
* How to install the gitman info manual?::
* How can I show Git's output?::
* Expanding a file to show the diff causes it to disappear::
* Magit claims repository accessed using Tramp does not exist::
* Can Magit be used as ediff-version-control-package?::
* How to show diffs for gpg-encrypted files?::
* Emacs 24.5 hangs when loading Magit: Emacs 245 hangs when loading Magit. 

@end detailmenu
@end menu



@node Introduction
@chapter Introduction

Magit is an interface to the version control system Git, implemented
as an Emacs package.  Magit aspires to be a complete Git porcelain.
While we cannot (yet) claim that Magit wraps and improves upon each
and every Git command, it is complete enough to allow even experienced
Git users to perform almost all of their daily version control tasks
directly from within Emacs.  While many fine Git clients exist, only
Magit and Git itself deserve to be called porcelains.

Staging and otherwise applying changes is one of the most important
features in a Git porcelain and here Magit outshines anything else,
including Git itself.  Git's own staging interface (@code{git add --patch})
is so cumbersome that many users only use it in exceptional cases.
In Magit staging a hunk or even just part of a hunk is as trivial as
staging all changes made to a file.

The most visible part of Magit's interface is the status buffer, which
displays information about the current repository.  Its content is
created by running several Git commands and making their output
actionable.  Among other things, it displays information about the
current branch, lists unpulled and unpushed changes and contains
sections displaying the staged and unstaged changes.  That might sound
noisy, but, since sections are collapsible, it's not.

To stage or unstage a change one places the cursor on the change and
then types @code{s} or @code{u}.  The change can be a file or a hunk, or when the
region is active (i.e. when there is a selection) several files or
hunks, or even just part of a hunk.  The change or changes that these
commands - and many others - would act on are highlighted.

Magit also implements several other "apply variants" in addition to
staging and unstaging.  One can discard or reverse a change, or
apply it to the working tree.  Git's own porcelain only supports this
for staging and unstaging and you would have to do something like @code{git
diff ... | ??? | git apply ...} to discard, revert, or apply a single
hunk on the command line.  In fact that's exactly what Magit does
internally (which is what lead to the term "apply variants").

Magit isn't just for Git experts, but it does assume some prior
experience with Git as well as Emacs.  That being said, many users
have reported that using Magit was what finally taught them what Git
it is capable off and how to use it to its fullest.  Other users
wished they had switched to Emacs sooner so that they would have
gotten their hands on Magit earlier.

While one has to know the basic features of Emacs to be able to make
full use of Magit, acquiring just enough Emacs skills doesn't take
long and is worth it, even for users who prefer other editors.  Vim
users are advised to give @uref{https://bitbucket.org/lyro/evil/wiki/Home,Evil}, the "Extensible VI Layer for Emacs",
and @uref{https://github.com/syl20bnr/spacemacs,Spacemacs}, an "Emacs starter-kit focused on Evil" a try.

Magit provides a consistent and efficient Git porcelain.  After a
short learning period, you will be able to perform most of your daily
version control tasks faster than you would on the command line.  You
will likely also start using features that seemed too daunting in the
past.

Magit fully embraces Git.  It exposes many advanced features using a
simple but flexible interface instead of only wrapping the trivial
ones like many GUI clients do.  Of course Magit supports logging,
cloning, pushing, and other commands that usually don't fail in
spectacular ways; but it also supports tasks that often cannot be
completed in a single step.  Magit fully supports tasks such as
merging, rebasing, cherry-picking, reverting, and blaming by not only
providing a command to initiate these tasks but also by displaying
context sensitive information along the way and providing commands
that are useful for resolving conflicts and resuming the sequence
after doing so.

Magit wraps and in many cases improves upon at least the following Git
porcelain commands: @code{add}, @code{am}, @code{bisect}, @code{blame}, @code{branch},
@code{checkout}, @code{cherry}, @code{cherry-pick}, @code{clean}, @code{clone}, @code{commit},
@code{config}, @code{describe}, @code{diff}, @code{fetch}, @code{format-patch}, @code{init}, @code{log},
@code{merge}, @code{merge-tree}, @code{mv}, @code{notes}, @code{pull}, @code{rebase}, @code{reflog},
@code{remote}, @code{request-pull}, @code{reset}, @code{revert}, @code{rm}, @code{show}, @code{stash},
@code{submodule}, and @code{tag}.  Many more Magit porcelain commands are
implemented on top of Git plumbing commands.

@node Installation
@chapter Installation

Magit can be installed using Emacs' package manager or manually from
its development repository.

@menu
* Updating from an older release::
* Installing from an Elpa archive::
* Installing from the Git repository::
* Post-installation tasks::
@end menu

@node Updating from an older release
@section Updating from an older release

When updating from @code{1.2.*} or @code{1.4.*}, you should first uninstall Magit
and some of its dependencies and restart Emacs before installing the
latest release.

@itemize
@item
The old Magit installation has to be removed because some macros
have changed and using the old definitions when building the new
release would lead to very strange results, including compile
errors.  This is due to a limitation in Emacs' package manager or
rather Emacs itself: it's not possible to reliably unload a feature
or even all features belonging to a package.


@item
Furthermore the old dependencies @code{git-commit-mode} and @code{git-rebase-mode}
have to be removed because they are no longer used by the @code{2.1.0}
release and get in the way of their successors @code{git-commit} and
@code{git-rebase}.
@end itemize

So please uninstall the packages @code{magit}, @code{git-commit-mode}, and
@code{git-rebase-mode}.  Then quit Emacs and start a new instance.  Only then
follow the instructions in either one of the next two sections.

Also note that starting with the @code{2.1.0} release, Magit requires at least
Emacs @code{24.4} and Git @code{1.9.4}.  You should make sure you have at least
these releases installed before updating Magit.  And if you connect to
remote hosts using Tramp, then you should also make sure to install a
recent enough Git version on these hosts.

@node Installing from an Elpa archive
@section Installing from an Elpa archive

If you are updating from a release older than @code{2.1.0}, then you have to
first uninstall the old version.  See @ref{Updating from an older release,Updating from an older release}.

Magit is available from all three of the popular unofficial Elpa
archives: Melpa, Melpa-Stable, and Marmalade.  If you haven't used
Emacs' package manager before, then it is high time you familiarize
yourself with it by reading the documentation in the Emacs manual,
see @ref{Packages,,,emacs,}.  Then add one of the archives to @code{package-archives}:

@itemize
@item
To use Melpa:
@end itemize

@lisp
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
@end lisp

@itemize
@item
To use Melpa-Stable:
@end itemize

@lisp
(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "http://stable.melpa.org/packages/") t)
@end lisp

@itemize
@item
To use Marmalade:
@end itemize

@lisp
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
@end lisp

Once you have added your preferred archive, you need to update the
local package list using:

@example
M-x package-refresh-contents RET
@end example

Once you have done that, you can install Magit and its dependencies
using:

@example
M-x package-install RET magit RET
@end example

Now see @ref{Post-installation tasks,Post-installation tasks}.

@node Installing from the Git repository
@section Installing from the Git repository

If you are updating from a release older than @code{2.1.0}, then you have to
first uninstall the old version.  See @ref{Updating from an older release,Updating from an older release}.

Magit depends on the @code{dash} library, available from all three of the
popular third-party Elpa archives.  Install it using @code{M-x
install-package RET dash RET}.  Of course you may also install it
manually from its development repository, but I won't cover that here.

Then clone the Magit repository:

@example
$ git clone git://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit
$ cd ~/.emacs.d/site-lisp/magit
@end example

Then compile the libraries and generate the info manuals:

@example
$ make
@end example

If you haven't installed @code{dash} using Elpa or at @code{/path/to/magit/../dash},
then you have to tell @code{make} where to find it.  To do so create
@code{/path/to/magit/config.mk} with the following content before running
@code{make}:

@example
LOAD_PATH = -L /path/to/magit/lisp -L /path/to/dash
@end example

Finally add this to your init file:

@lisp
(add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
(require 'magit)

(with-eval-after-load 'info
  (info-initialize)
  (add-to-list 'Info-directory-list
               "~/.emacs.d/site-lisp/magit/Documentation/"))
@end lisp

Note that you have to add the @code{lisp/} subdirectory to the @code{load-path},
not the top-level of the repository.

Instead of requiring the feature @code{magit}, you could only load the
autoloads, by loading the file @code{magit-autoloads.el}.

Instead of running Magit directly from the repository by adding that
to the @code{load-path}, you might want to instead install it in some other
directory using @code{sudo make install} and setting @code{load-path} accordingly.

To update Magit use:

@example
$ git pull
$ make
@end example

At times it might be necessary to run @code{make clean all} instead.

To view all available targets use @code{make help}.

Now see @ref{Post-installation tasks,Post-installation tasks}.

@node Post-installation tasks
@section Post-installation tasks

After installing Magit you should verify that you are indeed using the
Magit, Git, and Emacs releases you think you are using.  It's best to
restart Emacs before doing so, to make sure you are not using an
outdated value for @code{load-path}.

@example
M-x magit-version RET
@end example

should display something like

@example
Magit 2.1.0, Git 2.4.2, Emacs 24.5.1
@end example

Then you might also want to read about options that many users likely
want to customize.  See @ref{Essential settings,Essential settings}.

To be able to follow cross references to Git manpages found in this
manual, you might also have to manually install the @code{gitman} info manual,
or advice @code{Info-follow-nearest-node} to instead open the actual manpage.
See @ref{How to install the gitman info manual?,How to install the gitman info manual?}.

If you are completely new to Magit then see @ref{Getting started,Getting started}.

If you have used an older Magit release before, then you should have a
look at the release notes
@uref{https://raw.githubusercontent.com/magit/magit/master/Documentation/RelNotes/2.1.0.txt}.

And last but not least please consider making a donation, to ensure
that I can keep working on Magit.  See @uref{http://magit.vc/donations.html}
for various donation options.

@node Getting started
@chapter Getting started

This section describes the most essential features that many
Magitians use on a daily basis.  It only scratches the surface but
should be enough to get you started.

(You might want to create a repository just for this walk-through,
e.g. by cloning an existing repository.  If you don't use a separate
repository then make sure you create a snapshot as described below).

To display information about the current Git repository, type @code{M-x
magit-status}.  You will be doing that so often that it is best to bind
this command globally:

@lisp
(global-set-key (kbd "C-x g") 'magit-status)
@end lisp

Most Magit commands are commonly invoked from this buffer.  It should
be considered the primary interface to interact with Git using Magit.
There are many other Magit buffers, but they are usually created from
this buffer.

Depending on what state your repository is in, this buffer will
contain sections titled "Staged changes", "Unstaged changes",
"Unpulled commits", "Unpushed commits", and/or some others.

If some staged and/or unstaged changes exist, you should back them up
now.  Type @code{z} to show the stashing popup buffer featuring various stash
variants and arguments that can be passed to these commands.  Do not
worry about those for now, just type @code{Z} (uppercase) to create a stash
while also keeping the index and work tree intact.  The status buffer
should now also contain a section titled "Stashes".

Otherwise, if there are no uncommitted changes, you should create some
now by editing and saving some of the tracked files.  Then go back to
the status buffer, while at the same time refreshing it, by typing @code{C-x
g}.  (When the status buffer, or any Magit buffer for that matter, is
the current buffer, then you can also use just @code{g} to refresh it).

Move between sections using @code{p} and @code{n}.  Note that the bodies of some
sections are hidden.  Type @code{TAB} to expand or collapse the section at
point.  You can also use @code{C-tab} to cycle the visibility of the current
section and its children. Move to a file section inside the section
named "Unstaged changes" and type @code{s} to stage the changes you have made
to that file. That file now appears under "Staged changes".

Magit can stage and unstage individual hunks, not just complete files.
Move to the file you have just staged, expand it using @code{TAB}, move to
one of the hunks using @code{n}, and unstage just that by typing @code{u}.  Note how
the staging (@code{s}) and unstaging (@code{u}) commands operate on the change at
point.  Many other commands behave the same way.

You can also un-/stage just part of a hunk.  Inside the body of a hunk
section (move there using @code{C-n}), set the mark using @code{C-SPC} and move down
until some added and removed lines fall inside the region but not all
of them.  Again type @code{s} to stage.

It's also possible to un-/stage multiple files at once.  Move to a
file section, type @code{C-SPC}, move to the next file using @code{n}, and then @code{s} to
stage both files.  Note that both the mark and point have to be on the
headings of sibling sections for this to work.  If the region looks
like it does in other buffers, then it doesn't select Magit sections
that can be acted on as a unit.

And then of course you want to commit your changes.  Type @code{c}.  This
shows the committing popup buffer featuring various commit variants
and arguments that can be passed to @code{git commit}.  Do not worry about
those for now.  We want to create a "normal" commit, which is done by
typing @code{c} again.

Now two new buffers appear.  One is for writing the commit message,
the other shows a diff with the changes that are about to committed.
Write a message and then type @code{C-c C-c} to actually create the commit.

You probably don't want to push the commit you just created because
you just committed some random changes, but if that is not the case
you could push it by typing @code{P} to bring up the push popup and then @code{P}
again to push to the configured upstream.  (If the upstream is not
configured, then you would be prompted for the push target instead.)

Instead we are going to undo the changes made so far.  Bring up the
log for the current branch by typing @code{l l}, move to the last commit
created before starting with this walk through using @code{n}, and do a hard
reset using @code{C-u x}.  @strong{WARNING}: this discards all uncommitted changes.
If you did not follow the advice about using a separate repository for
these experiments and did not create a snapshot of uncommitted changes
before starting to try out Magit, then don't do this.

So far we have mentioned the commit, push, and log popups.  These are
probably among the popups you will be using the most, but many others
exist.  To show a popup with all other popups (and some other commands
which are not popups), type @code{h}.  Try a few.

In most cases the key bindings in that popup correspond to the
bindings in Magit buffers, including but not limited to the status
buffer.  So you could type @code{h d} to bring up the diff popup, but once
you remember that "d" stands for "diff", you would usually do so by
just typing @code{d}.  But the "popup of popups" is useful even once you have
memorized all the bindings, as it can provide easy access to Magit
commands from non-Magit buffers.  So you should bind this globally
too:

@lisp
(global-set-key (kbd "C-x M-g") 'magit-dispatch-popup)
@end lisp

@node Interface concepts
@chapter Interface concepts


@menu
* Modes and Buffers::
* Automatic save::
* Automatic refresh and revert::
* Sections::
* Popup buffers and prefix commands::
* Completion and confirmation::
* Running Git::
@end menu

@node Modes and Buffers
@section Modes and Buffers

Magit provides several major modes.  For each of these modes there
usually exists only one buffer per repository.  Separate modes and
thus buffers exist for commits, diffs, logs, and some other things.

In this manual we often speak about "Magit buffers".  By that we mean
buffers whose major-modes derive from @code{magit-mode}.

Besides these special purpose buffers, there also exists an overview
buffer, called the @strong{status buffer}.  Its usually from this buffer that
the user invokes Git commands, or creates or visits other buffers.

@table @asis
@kindex q
@cindex magit-mode-bury-buffer
@item @kbd{q} @tie{}@tie{}@tie{}@tie{}(@code{magit-mode-bury-buffer})

This command buries the current Magit buffer.  With a prefix
argument, it instead kills the buffer.

If @code{magit-restore-window-configuration} is non-nil and the last
configuration stored by @code{magit-mode-display-buffer} originates from
the selected frame (which usually is the case), then that is restored
after burying or killing the buffer.

@end table

@defopt magit-restore-window-configuration

This option controls whether quitting a Magit buffer restores the
previous window configuration.
@end defopt

While it often is enough to have one buffer of a certain Magit mode
per repository, this is not always the case.  You might, for example,
want to view the diffs for two commits at the same time.  To do so,
first rename the existing revision buffer.  Then show another commit.
Usually that would reuse the existing buffer, but because its name no
longer matches the default name, a new buffer is created instead.  The
new buffer uses the default name, and therefore will be reused to show
other commits as usual.

@table @asis
@kindex M-x magit-rename-buffer
@cindex magit-rename-buffer
@item @kbd{M-x magit-rename-buffer} @tie{}@tie{}@tie{}@tie{}(@code{magit-rename-buffer})

This command changes the name of the current Magit buffer by
appending @code{<N>} and thereby keeping Magit from re-using it to display
other information of the same kind.

With a prefix argument, the user can pick an arbitrary name.
@end table

@node Automatic save
@section Automatic save

File-visiting buffers are by default saved at certain points in time.
This doesn't guarantee that Magit buffers are always up-to-date, but,
provided one only edits files by editing them in Emacs and uses only
Magit to interact with Git, one can be fairly confident.  When in
doubt or after outside changes, type @code{g} (@code{magit-refresh}) to save and
refresh explicitly.

@defopt magit-save-repository-buffers

This option controls whether file-visiting buffers are saved before
certain events.

If this is non-nil then all modified file-visiting buffers belonging
to the current repository may be saved before running commands,
before creating new Magit buffers, and before explicitly refreshing
such buffers.  If this is @code{dontask} then this is done without user
intervention.  If it is @code{t} then the user has to confirm each save.
@end defopt

@node Automatic refresh and revert
@section Automatic refresh and revert

After running a commands which may change the state of the current
repository, the current Magit buffer and the corresponding status
buffer are refreshed.  This ensures that the displayed information is
up-to-date but can lead to a noticeable delay in big repositories.
Other Magit buffers are not refreshed to keep the delay to a minimum
and also because doing so can sometimes be undesirable.

@defopt magit-revert-buffers

This option controls if and how file-visiting buffers in the current
repository are reverted.

Unmodified buffers visiting files belonging to the current
repository may be reverted after refreshing the current Magit buffer
and after running certain other commands.

@itemize
@item
@code{nil}

Don't revert any buffers.


@item
@code{ask}

List the buffers which might potentially have to be reverted and
ask the user whether she wants to revert them.  If so, then do it
synchronously.


@item
@code{t}

Revert the buffers synchronously, mentioning each one as it is
being reverted and then also show a summary in the echo area.


@item
@code{usage}

Like @code{t} but include usage information in the summary.  This is the
default so that users come here and pick what is right for them.


@item
@code{silent}

Revert the buffers synchronously and be quiet about it.


@item
NUMBER

An integer or float.  Revert the buffers asynchronously,
mentioning each one as it is being reverted.  If user input
arrives, then stop reverting.  After NUMBER seconds resume
reverting.
@end itemize
@end defopt

Buffers can also be refreshed explicitly, which is useful in buffers
that weren't current during the last refresh and after changes were
made to the repository outside of Magit.

@table @asis
@kindex g
@cindex magit-refresh
@item @kbd{g} @tie{}@tie{}@tie{}@tie{}(@code{magit-refresh})

This command refreshes the current buffer if its major mode derives
from @code{magit-mode} as well as the corresponding status buffer.

If the option @code{magit-revert-buffers} calls for it, then it also
reverts all unmodified buffers that visit files being tracked in the
current repository.

@kindex G
@cindex magit-refresh-all
@item @kbd{G} @tie{}@tie{}@tie{}@tie{}(@code{magit-refresh-all})

This command refreshes all Magit buffers belonging to the current
repository and also reverts all unmodified buffers that visit files
being tracked in the current repository.

The file-visiting buffers are always reverted, even if
@code{magit-revert-buffers} is nil.

@end table

@defopt magit-refresh-buffer-hook

This hook is run in each Magit buffer that was refreshed during the
current refresh - normally the current buffer and the status buffer.
@end defopt

@defopt magit-after-revert-hook

This hook is run in each file-visiting buffer belonging to the
current repository that was actually reverted during a refresh.

Note that adding something here is very expensive.  If you
experience performance issues, you might want to check this hook, as
well as @code{magit-not-reverted-hook} and, if possible, remove some of the
functions added by third-party packages.
@end defopt

@defopt magit-not-reverted-hook

This hook is run in each file-visiting buffer belonging to the
current repository that was reverted during a refresh.  The file
was not reverted because it did not change, and so Magit does not
have to do anything.  This hook is intended for third-party
extensions that need to run some functions even on such files.
@end defopt

@node Sections
@section Sections

Magit buffers are organized into nested sections, which can be
collapsed and expanded, similar to how sections are handled in Org
mode.  Each section also has a type, and some sections also have a
value.  For each section type there can also be a local keymap, shared
by all sections of that type.

Taking advantage the section value and type, many commands operate on
the current section, or when the region is active and selects sections
of the same type, all of the selected sections.  Commands that only
make sense for a particular section type (as opposed to just behaving
differently depending on the type) are usually bound in section type
keymaps.

@menu
* Section movement::
* Section visibility::
* Section hooks::
* Section types and values::
* Section options::
@end menu

@node Section movement
@subsection Section movement

To move within a section use the usual keys (@code{C-p}, @code{C-n}, @code{C-b}, @code{C-f} etc),
whose global bindings are not shadowed.  To move to another section use
the following commands.

@table @asis
@kindex p
@cindex magit-section-backward
@item @kbd{p} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-backward})

When not at the beginning of a section, then move to the beginning
of the current section.  At the beginning of a section, instead move
to the beginning of the previous visible section.

@kindex n
@cindex magit-section-forward
@item @kbd{n} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-forward})

Move to the beginning of the next visible section.

@kindex P
@cindex magit-section-backward-siblings
@item @kbd{P} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-backward-siblings})

Move to the beginning of the previous sibling section.  If there is
no previous sibling section, then move to the parent section
instead.

@kindex N
@cindex magit-section-forward-siblings
@item @kbd{N} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-forward-siblings})

Move to the beginning of the next sibling section.  If there is no
next sibling section, then move to the parent section instead.

@kindex ^
@cindex magit-section-up
@item @kbd{^} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-up})

Move to the beginning of the parent of the current section.
@end table

The above commands all call the hook @code{magit-section-movement-hook}.
And, except for the second, the below functions are all members of
that hook's default value.

@defvar magit-section-movement-hook

This hook is run by all of the above movement commands, after
arriving at the destination.
@end defvar

@defun magit-hunk-set-window-start

This hook function ensures that the beginning of the current section
is visible, provided it is a @code{hunk} section.  Otherwise, it does
nothing.
@end defun

@defun magit-section-set-window-start

This hook function ensures that the beginning of the current section
is visible, regardless of the section's type.  If you add this to
@code{magit-section-movement-hook}, then you must remove the hunk-only
variant in turn.
@end defun

@defun magit-log-maybe-show-commit

This hook function shows the commit at point in another window.  If
the section at point is a @code{commit} section and the value of
@code{magit-diff-auto-show-p} calls for it, then the commit is shown in
another window, using @code{magit-show-commit}.
@end defun

@defun magit-log-maybe-show-more-commits

This hook function only has an effect in log buffers, and @code{point} is
on the "show more" section.  If that is the case, then it doubles
the number of commits that are being shown.
@end defun

@node Section visibility
@subsection Section visibility

Magit provides many commands for changing the visibility of sections,
but all you need to get started are the next two.

@table @asis
@kindex TAB
@cindex magit-section-toggle
@item @kbd{TAB} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-toggle})

Toggle the visibility of the body of the current section.

@kindex C-<tab>
@cindex magit-section-cycle
@item @kbd{C-<tab>} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-cycle})

Cycle the visibility of current section and its children.

@kindex M-<tab>
@cindex magit-section-cycle-diffs
@item @kbd{M-<tab>} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-cycle-diffs})

Cycle the visibility of diff-related sections in the current buffer.

@kindex s-<tab>
@cindex magit-section-cycle-global
@item @kbd{s-<tab>} @tie{}@tie{}@tie{}@tie{}(@code{magit-section-cycle-global})

Cycle the visibility of all sections in the current buffer.
@end table

@kindex 1
@kindex 2
@kindex 3
@kindex 4
@cindex magit-section-show-level-1
@deffn Command magit-section-show-level-1
@cindex magit-section-show-level-2
@deffnx Command magit-section-show-level-2
@cindex magit-section-show-level-3
@deffnx Command magit-section-show-level-3
@cindex magit-section-show-level-4
@deffnx Command magit-section-show-level-4

To show sections surrounding the current section, up to level N,
press the respective number key (@code{1}, @code{2}, @code{3}, or @code{4}).
@end deffn

@kindex M-1
@kindex M-2
@kindex M-3
@kindex M-4
@cindex magit-section-show-level-1-all
@deffn Command magit-section-show-level-1-all
@cindex magit-section-show-level-2-all
@deffnx Command magit-section-show-level-2-all
@cindex magit-section-show-level-3-all
@deffnx Command magit-section-show-level-3-all
@cindex magit-section-show-level-4-all
@deffnx Command magit-section-show-level-4-all

To show all sections up to level N, press the respective number key
and meta (@code{M-1}, @code{M-2}, @code{M-3}, or @code{M-4}).
@end deffn

Some functions, which are used to implement the above commands, are
also exposed as commands themselves.  By default no keys are bound to
these commands, as they are generally perceived to be much less
useful.  But your mileage may vary.

@cindex magit-section-show
@deffn Command magit-section-show

Show the body of the current section.
@end deffn

@cindex magit-section-hide
@deffn Command magit-section-hide

Hide the body of the current section.
@end deffn

@cindex magit-section-show-headings
@deffn Command magit-section-show-headings

Recursively show headings of children of the current section.  Only
show the headings.  Previously shown text-only bodies are hidden.
@end deffn

@cindex magit-section-show-children
@deffn Command magit-section-show-children

Recursively show the bodies of children of the current section.
With a prefix argument show children down to the level of the
currect section, and hide deeper children.
@end deffn

@cindex magit-section-hide-children
@deffn Command magit-section-hide-children

Recursively hide the bodies of children of the current section.
@end deffn

@cindex magit-section-toggle-children
@deffn Command magit-section-toggle-children

Toggle visibility of bodies of children of the current section.
@end deffn

When a buffer is first created then some sections are shown expanded
while others are not.  This is hard coded.  When a buffer is refreshed
then the previous visibility is preserved. The initial visibility of
certain sections can also be overwritten using the hook
@code{magit-section-set-visibility-hook}.

@defvar magit-section-set-visibility-hook

This hook is run when first creating a buffer and also when
refreshing an existing buffer, and is used to determine the
visibility of the section currently being inserted.

Each function is called with one argument, the section being
inserted.  It should return @code{hide} or @code{show}, or to leave the visibility
undefined @code{nil}.  If no function decides on the visibility and the
buffer is being refreshed, then the visibility is preserved; or if
the buffer is being created, then the hard coded default is used.

Usually this should only be used to set the initial visibility but
not during refreshes.  If @code{magit-insert-section--oldroot} is non-nil,
then the buffer is being refreshed and these functions should
immediately return @code{nil}.
@end defvar

@node Section hooks
@subsection Section hooks

Which sections are inserted into certain buffers is controlled with
hooks.  This includes the status and the refs buffers.  For other
buffers, e.g. log, diff, and revision buffers, this is not possible.

For buffers whose sections can be customized by the user, a hook
variable called @code{magit-TYPE-sections-hook} exists.  This hook should be
changed using @code{magit-add-section-hook}.  Avoid using @code{add-hooks} or the
Custom interface.

The various available section hook variables are described later in
this manual along with the appropriate "section inserter functions".

@defun magit-add-section-hook hook function &optional at append local

Add the function FUNCTION to the value of section hook HOOK.

Add FUNCTION at the beginning of the hook list unless optional
APPEND is non-nil, in which case FUNCTION is added at the end.  If
FUNCTION already is a member then move it to the new location.

If optional AT is non-nil and a member of the hook list, then add
FUNCTION next to that instead.  Add before or after AT depending
on APPEND.  If only FUNCTION is a member of the list, then leave
it wherever it already is.

If optional LOCAL is non-nil, then modify the hook's buffer-local
value rather than its global value.  This makes the hook local by
copying the default value.  That copy is then modified.

HOOK should be a symbol.  If HOOK is void, it is first set to nil.
HOOK's value must not be a single hook function.  FUNCTION should
be a function that takes no arguments and inserts one or multiple
sections at point, moving point forward.  FUNCTION may choose not
to insert its section(s), when doing so would not make sense.  It
should not be abused for other side-effects.
@end defun

To remove a function from a section hook, use @code{remove-hook}.

@node Section types and values
@subsection Section types and values

Each section has a type, for example @code{hunk}, @code{file}, and @code{commit}.
Instances of certain section types also have a value.  The value of a
section of type @code{file}, for example, is a file name.

Users usually do not have to worry about a section's type and value,
but knowing them can be handy at times.

@table @asis
@kindex M-x magit-describe-section
@cindex magit-describe-section
@item @kbd{M-x magit-describe-section} @tie{}@tie{}@tie{}@tie{}(@code{magit-describe-section})

Show information about the section at point in the echo area,
as "VALUE [TYPE PARENT-TYPE@dots{}] BEGINNING-END".
@end table

Many commands behave differently depending on the type of the section
at point and/or somehow consume the value of that section.  But that
is only one of the reasons why the same key may do something different,
depending on what section is current.

Additionally for each section type a keymap @strong{might} be defined, named
@code{magit-TYPE-section-map}.  That keymap is used as text property keymap
of all text belonging to any section of the respective type.  If such
a map does not exist for a certain type, then you can define it
yourself, and it will automatically be used.

@node Section options
@subsection Section options

This section describes options that have an effect on more than just a
certain type of sections.  As you can see there are not many of those.

@defopt magit-section-show-child-count

Whether to append the number of children to section headings.  This
only affects sections that could benefit from this information.
@end defopt

@node Popup buffers and prefix commands
@section Popup buffers and prefix commands

Many Magit commands are implemented using @strong{popup buffers}.  First the
user invokes a @strong{popup} or @strong{prefix} command, which causes a popup buffer
with the available @strong{infix} arguments and @strong{suffix} commands to be
displayed.  The user then optionally toggles/sets some arguments and
finally invokes one of the suffix commands.

This is implemented in the library @code{magit-popup}.  Earlier releases used
the library @code{magit-key-mode}.  A future release will switch to a
yet-to-be-written successor, which will likely be named @code{transient}.

Because @code{magit-popup} can also be used by other packages without having
to depend on all of Magit, it is documented in its own manual.  See
@ref{Top,,,magit-popup,}.

@table @asis
@kindex C-c C-c
@cindex magit-dispatch-popup
@item @kbd{C-c C-c} @tie{}@tie{}@tie{}@tie{}(@code{magit-dispatch-popup})

This popup command shows a buffer featuring all other Magit popup
commands as well as some other commands that are not popup commands
themselves.
@end table

This command is also, or especially, useful outside Magit buffers, so
you should setup a global binding:

@lisp
(global-set-key (kbd "C-x M-g") 'magit-dispatch-popup)
@end lisp

@node Completion and confirmation
@section Completion and confirmation

Many commands read a value from the user.  By default this is done
using the built-in function @code{completing-read}, but Magit can instead use
another completion framework.

@defopt magit-completing-read-function

The value of this variable is the function used to perform
completion.  Because functions @emph{intended} to replace @code{completing-read}
often are not fully compatible drop-in replacements, and also
because Magit expects them to add the default choice to the prompt
themselves, such functions should not be used directly.  Instead a
wrapper function has to be used.
@end defopt

Currently only the real @code{completing-read} and @uref{http://www.emacswiki.org/emacs/InteractivelyDoThings,Ido} are fully supported.
More frameworks will be supported in the future.

@defun magit-builtin-completing-read prompt choices &optional predicate require-match initial-input hist def

Perform completion using @code{completion-read}.
@end defun

@defun magit-ido-completing-read prompt choices &optional predicate require-match initial-input hist def

Perform completion using @code{ido-completing-read+} from the package by
the same name (which you have to explicitly install).  Ido itself
comes with a supposed drop-in replacement @code{ido-completing-read}, but
that has too many deficits to serve our needs.
@end defun

By default many commands that could potentially lead to data loss have
to be confirmed.  This includes many very common commands, so this
can become annoying quickly.  Many of these actions can be undone,
provided @code{magit-wip-before-change-mode} is turned on (which it is not by
default, due to performance concerns).

@defopt magit-no-confirm

The value of this option is a list of symbols, representing commands
which do not have to be confirmed by the user before being carried
out.

When the global mode @code{magit-wip-before-change-mode} is enabled then
many commands can be undone.  If that mode is enabled then adding
@code{safe-with-wip} to this list has the same effect as adding @code{discard},
@code{reverse}, @code{stage-all-changes}, and @code{unstage-all-changes}.

@lisp
(add-to-list 'magit-no-confirm 'safe-with-wip)
@end lisp

For a list of all symbols that can be added to the value of this
variable, see the doc-string.
@end defopt

Note that there are commands that ignore this option and always
require confirmation, or which can be told not to do so using another
dedicated option.  Also most commands, when acting on multiple sections
at once always, require confirmation, even when they do respect this
option when acting on a single section.

@node Running Git
@section Running Git


@menu
* Viewing Git output::
* Running Git manually::
* Git executable::
* Global Git arguments::
@end menu

@node Viewing Git output
@subsection Viewing Git output

Magit runs Git either for side-effects (e.g. when pushing) or to get
some value (e.g. the name of the current branch).  When Git is run for
side-effects then the output goes into a per-repository log buffer,
which can be consulted when things don't go as expected.

@table @asis
@kindex $
@cindex magit-process
@item @kbd{$} @tie{}@tie{}@tie{}@tie{}(@code{magit-process})

This commands displays the process buffer for the current
repository.
@end table

Inside that buffer, the usual key bindings for navigating and showing
sections are available.  There is one additional command.

@table @asis
@kindex k
@cindex magit-process-kill
@item @kbd{k} @tie{}@tie{}@tie{}@tie{}(@code{magit-process-kill})

This command kills the process represented by the section at point.

@end table

@defopt magit-git-debug

When this is non-nil then the output of all calls to git are logged
in the process buffer.  This is useful when debugging, otherwise it
just negatively affects performance.
@end defopt

@node Running Git manually
@subsection Running Git manually

While Magit provides many Emacs commands to interact with Git, it does
not cover everything.  In those cases your existing Git knowledge will
come in handy.  Magit provides some commands for running arbitrary Git
commands by typing them into the minibuffer, instead of having to
switch to a shell.

@table @asis
@kindex !
@cindex magit-run-popup
@item @kbd{!} @tie{}@tie{}@tie{}@tie{}(@code{magit-run-popup})

Show the popup buffer featuring the below suffix commands.

@kindex ! !
@cindex magit-git-command-topdir
@item @kbd{! !} @tie{}@tie{}@tie{}@tie{}(@code{magit-git-command-topdir})

Execute a Git subcommand asynchronously, displaying the output.

With a prefix argument run Git in the root of the current
repository.

@kindex ! :
@cindex magit-git-command
@item @kbd{! :} @tie{}@tie{}@tie{}@tie{}(@code{magit-git-command})

Execute a Git subcommand asynchronously, displaying the output.
Run Git in the top-level directory of the current repository.
@end table

This popup also features some commands that start external gui tools.

@table @asis
@kindex ! g
@cindex magit-run-git-gui
@item @kbd{! g} @tie{}@tie{}@tie{}@tie{}(@code{magit-run-git-gui})

Run @code{git gui} for the current git repository.

@kindex ! k
@cindex magit-run-gitk
@item @kbd{! k} @tie{}@tie{}@tie{}@tie{}(@code{magit-run-gitk})

Run Gitk for the current git repository.

Run @code{gitk --all}.  With a prefix argument run gitk without any
arguments.
@end table

@node Git executable
@subsection Git executable

Except on MS Windows, Magit defaults to running Git without specifying
the path to the git executable.  Instead the first executable found by
Emacs on @code{exec-path} is used (whose value in turn is set based on the
value of the environment variable @code{$PATH} when Emacs was started).

This has the advantage that it continues to work even when using Tramp
to connect to a remote machine on which the executable is found in a
different place.  The downside is that if you have multiple versions
of Git installed, then you might end up using another version than the
one you think you are using.

@table @asis
@kindex M-x magit-version
@cindex magit-version
@item @kbd{M-x magit-version} @tie{}@tie{}@tie{}@tie{}(@code{magit-version})

Shows the currently used versions of Magit, Git, and Emacs in the
echo area.  Non-interactively this just returns the Magit version.
@end table

When the @code{system-type} is @code{windows-nt}, then @code{magit-git-executable} is set
to an absolute path when Magit is first loaded.  This is necessary
because Git on that platform comes with several wrapper scripts for
the actual git binary, which are also placed on @code{$PATH}, and using one
of these wrappers instead of the binary would degrade performance
horribly.

If Magit doesn't find the correct executable then you @strong{can} work around
that by setting @code{magit-git-executable} to an absolute path.  But note
that doing so is a kludge.  It is better to make sure the order in the
environment variable @code{$PATH} is correct, and that Emacs is started with
that environment in effect.  If you have to connect from Windows to a
non-Windows machine, then you must change the value to "git".

@defopt magit-git-executable

The git executable used by Magit, either the full path to the
executable or the string "git" to let Emacs find the executable
itself, using the standard mechanism for doing such things.
@end defopt

@node Global Git arguments
@subsection Global Git arguments

@defopt magit-git-global-arguments

The arguments set here are used every time the git executable is run
as a subprocess.  They are placed right after the executable itself
and before the git command - as in @code{git HERE... COMMAND REST}.  For
valid arguments see 
@ifinfo
@ref{git,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git">git(1)</a> manpage
@end html
@end ifhtml
@iftex
the git(1) manpage
@end iftex
.

Be careful what you add here, especially if you are using Tramp to
connect to servers with ancient Git versions.  Never remove anything
that is part of the default value, unless you really know what you
are doing.  And think very hard before adding something; it will be
used every time Magit runs Git for any purpose.
@end defopt

@node Inspecting
@chapter Inspecting

The functionality provided by Magit can be roughly divided into three
groups: inspecting existing data, manipulating existing data or adding
new data, and transferring data.  Of course that is a rather crude
distinction that often falls short, but it's more useful than no
distinction at all.  This section is concerned with inspecting data,
the next two with manipulating and transferring it.  Then follows a
section about miscellaneous functionality, which cannot easily be fit
into this distinction.

Of course other distinctions make sense too, e.g. Git's distinction
between porcelain and plumbing commands, which for the most part is
equivalent to Emacs' distinction between interactive commands and
non-interactive functions.  All of the sections mentioned before are
mainly concerned with the porcelain -- Magit's plumbing layer is
described later.

@menu
* Status buffer::
* Logging::
* Diffing::
* Ediffing::
* References buffer::
* Bisecting::
* Visiting blobs::
* Blaming::
@end menu

@node Status buffer
@section Status buffer

While other Magit buffers contain e.g. one particular diff or one
particular log, the status buffer contains the diffs for staged and
unstaged changes, logs for unpushed and unpulled commits, lists of
stashes and untracked files, and information related to the current
branch.

During certain incomplete operations -- for example when a merge
resulted in a conflict -- additional information is displayed that
helps proceeding with or aborting the operation.

The command @code{magit-status} displays the status buffer belonging to the
current repository in another window.  This command is used so often
that it should be bound globally.  We recommend using @code{C-x g}:

@lisp
(global-set-key (kbd "C-x g") 'magit-status)
@end lisp

@table @asis
@kindex C-x g
@cindex magit-status
@item @kbd{C-x g} @tie{}@tie{}@tie{}@tie{}(@code{magit-status})

Show the status of the current Git repository in a buffer.
With a prefix argument prompt for a repository to be shown.
With two prefix arguments prompt for an arbitrary directory.
If that directory isn't the root of an existing repository,
then offer to initialize it as a new repository.

@end table

@defopt magit-repository-directories

Directories containing Git repositories.  Magit checks these
directories for Git repositories and offers them as choices when
@code{magit-status} is used with a prefix argument.
@end defopt

@defopt magit-repository-directories-depth

The maximum depth to look for Git repositories.  When looking for
a Git repository below the directories in
@code{magit-repository-directories}, only descend this many levels deep.
@end defopt

@cindex ido-enter-magit-status
@deffn Command ido-enter-magit-status

From an Ido prompt used to open a file, instead drop into
@code{magit-status}.  This is similar to @code{ido-magic-delete-char}, which,
despite its name, usually causes a Dired buffer to be created.

To make this command available, use something like:

@lisp
(add-hook 'ido-setup-hook
          (lambda ()
            (define-key ido-completion-map
              (kbd \"C-x g\") 'ido-enter-magit-status)))
@end lisp

Starting with Emacs 25.1 that keymap can also be customized in a
sane fashion:

@lisp
(define-key ido-completion-map
   (kbd \"C-x g\") 'ido-enter-magit-status)))
@end lisp
@end deffn

@menu
* Status sections::
* Status header sections::
* Status options::
@end menu

@node Status sections
@subsection Status sections

The contents of status buffers is controlled using the hook
@code{magit-status-sections-hook}.  See @ref{Section hooks,Section hooks} to learn about such
hooks and how to customize them.

@defopt magit-status-sections-hook

Hook run to insert sections into a status buffer.
@end defopt

The first function on that hook by default is
@code{magit-insert-status-headers}; it is described in the next section.
By default the following functions are also members of that hook:

@defun magit-insert-merge-log

Insert section for the on-going merge.  Display the heads that are
being merged.  If no merge is in progress, do nothing.
@end defun

@defun magit-insert-rebase-sequence

Insert section for the on-going rebase sequence.
If no such sequence is in progress, do nothing.
@end defun

@defun magit-insert-am-sequence

Insert section for the on-going patch applying sequence.
If no such sequence is in progress, do nothing.
@end defun

@defun magit-insert-sequencer-sequence

Insert section for the on-going cherry-pick or revert sequence.
If no such sequence is in progress, do nothing.
@end defun

@defun magit-insert-bisect-output

While bisecting, insert section with output from @code{git bisect}.
@end defun

@defun magit-insert-bisect-rest

While bisecting, insert section visualizing the bisect state.
@end defun

@defun magit-insert-bisect-log

While bisecting, insert section logging bisect progress.
@end defun

@defun magit-insert-untracked-files

Maybe insert a list or tree of untracked files.
Do so depending on the value of @code{status.showUntrackedFiles}.
@end defun

@defun magit-insert-unstaged-changes

Insert section showing unstaged changes.
@end defun

@defun magit-insert-staged-changes

Insert section showing staged changes.
@end defun

@defun magit-insert-stashes &optional ref heading

Insert the @code{stashes} section showing reflog for "refs/stash".
If optional REF is non-nil show reflog for that instead.
If optional HEADING is non-nil use that as section heading
instead of "Stashes:".
@end defun

@defun magit-insert-unpulled-commits

Insert section showing unpulled commits.
@end defun

@defun magit-insert-unpushed-commits

Insert section showing unpushed commits.
@end defun

The following functions can also be added to the above hook:

@defun magit-insert-tracked-files

Insert a tree of tracked files.
@end defun

@defun magit-insert-unpulled-or-recent-commits

Insert section showing unpulled or recent commits.
If an upstream is configured for the current branch and it is
ahead of the current branch, then show the missing commits.
Otherwise, show the last @code{magit-log-section-commit-count}
commits.
@end defun

@defun magit-insert-recent-commits

Insert section showing the last @code{magit-log-section-commit-count}
commits.
@end defun

@defopt magit-log-section-commit-count

How many recent commits @code{magit-insert-recent-commits} and
@code{magit-insert-unpulled-or-recent-commits} (provided there are no
unpulled commits) show.
@end defopt

@defun magit-insert-unpulled-cherries

Insert section showing unpulled commits.
Like @code{magit-insert-unpulled-commits} but prefix each commit
that has not been applied yet (i.e. a commit with a patch-id
not shared with any local commit) with "+", and all others
with "-".
@end defun

@defun magit-insert-unpulled-module-commits

Insert sections for all submodules with unpulled commits.
These sections can be expanded to show the respective commits.
@end defun

@defun magit-insert-unpushed-cherries

Insert section showing unpushed commits.
Like @code{magit-insert-unpushed-commits} but prefix each commit
which has not been applied to upstream yet (i.e. a commit with
a patch-id not shared with any upstream commit) with "+" and
all others with "-".
@end defun

@defun magit-insert-unpushed-module-commits

Insert sections for all submodules with unpushed commits.
These sections can be expanded to show the respective commits.
@end defun

See @ref{References buffer,References buffer} for some more section inserters, which could be
used here.

@node Status header sections
@subsection Status header sections

The contents of status buffers is controlled using the hook
@code{magit-status-sections-hook}, as described in the previous section.
By default @code{magit-insert-status-headers} is the first member of that
hook variable.

@defun magit-insert-status-headers

Insert headers sections appropriate for @code{magit-status-mode} buffers.
The sections are inserted by running the functions on the hook
@code{magit-status-headers-hook}.
@end defun

@defopt magit-status-headers-hook

Hook run to insert headers sections into the status buffer.

This hook is run by @code{magit-insert-status-headers}, which in turn has
to be a member of @code{magit-insert-status-sections} to be used at all.
@end defopt

By default the following functions are members of the above hook:

@defun magit-insert-head-header

Insert a header line about the @code{HEAD} commit.
@end defun

@defun magit-insert-upstream-header

Insert a header line about the upstream branch and its tip.
@end defun

@defun magit-insert-tags-header

Insert a header line about the current and/or next tag.
@end defun

The following functions can also be added to the above hook:

@defun magit-insert-repo-header

Insert a header line showing the path to the repository top-level.
@end defun

@defun magit-insert-remote-header

Insert a header line about the remote of the current branch.
@end defun

@node Status options
@subsection Status options

@defopt magit-status-refresh-hook

Hook run after a status buffer has been refreshed.
@end defopt

@defopt magit-status-buffer-switch-function

Function used by @code{magit-status} to switch to a status buffer.
The function is given one argument, the status buffer.
@end defopt

@defopt magit-status-buffer-name-format

Name format for buffers used to display a repository's status.

The following @code{format}-like specs are supported:
@code{%a} the absolute filename of the repository top-level.
@code{%b} the basename of the repository top-level.
@end defopt

@defopt magit-log-section-args

Additional Git arguments used when creating log sections.  Only
@code{--graph}, @code{--decorate}, and @code{--show-signature} are supported.  This
option is only a temporary kludge and will be removed.

Note that due to an issue in Git the use of @code{--graph} is very slow
with long histories, so you probably don't want to add this here.
@end defopt

Also see the proceeding section for more options concerning status
buffers.

@node Logging
@section Logging

Also see 
@ifinfo
@ref{git-log,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-log">git-log(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-log(1) manpage
@end iftex
.

@table @asis
@kindex l
@cindex magit-log-popup
@item @kbd{l} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex l l
@cindex magit-log-current
@item @kbd{l l} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-current})

Show log for the current branch.  When @code{HEAD} is detached or with a
prefix argument, show log for one or more revs read from the
minibuffer.

@kindex l o
@cindex magit-log
@item @kbd{l o} @tie{}@tie{}@tie{}@tie{}(@code{magit-log})

Show log for one or more revs read from the minibuffer.  The user
can input any revision or revisions separated by a space, or even
ranges, but only branches, tags, and a representation of the
commit at point are available as completion candidates.

@kindex l h
@cindex magit-log-head
@item @kbd{l h} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-head})

Show log for @code{HEAD}.

@kindex l L
@cindex magit-log-branches
@item @kbd{l L} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-branches})

Show log for all local branches and @code{HEAD}.

@kindex l b
@cindex magit-log-all-branches
@item @kbd{l b} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-all-branches})

Show log for all local and remote branches and @code{HEAD}.

@kindex l a
@cindex magit-log-all
@item @kbd{l a} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-all})

Show log for all references and @code{HEAD}.
@end table

The following related commands are not available from the popup.

@table @asis
@kindex Y
@cindex magit-cherry
@item @kbd{Y} @tie{}@tie{}@tie{}@tie{}(@code{magit-cherry})

Show commits in a branch that are not merged in the upstream branch.

@kindex M-x magit-log-buffer-file
@cindex magit-log-buffer-file
@item @kbd{M-x magit-log-buffer-file} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-buffer-file})

Show log for the file visited in the current buffer.
@end table

@menu
* Log Buffer::
* Select from log::
* Reflog::
@end menu

@node Log Buffer
@subsection Log Buffer

@table @asis
@kindex C-c C-b
@cindex magit-go-backward
@item @kbd{C-c C-b} @tie{}@tie{}@tie{}@tie{}(@code{magit-go-backward})

Move backward in current buffer's history.

@kindex C-c C-f
@cindex magit-go-forward
@item @kbd{C-c C-f} @tie{}@tie{}@tie{}@tie{}(@code{magit-go-forward})

Move forward in current buffer's history.

@kindex SPC
@cindex magit-diff-show-or-scroll-up
@item @kbd{SPC} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-show-or-scroll-up})

Update the commit or diff buffer for the thing at point.

Either show the commit or stash at point in the appropriate buffer,
or if that buffer is already being displayed in the current frame
and contains information about that commit or stash, then instead
scroll the buffer up.  If there is no commit or stash at point, then
prompt for a commit.

@kindex DEL
@cindex magit-diff-show-or-scroll-down
@item @kbd{DEL} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-show-or-scroll-down})

Update the commit or diff buffer for the thing at point.

Either show the commit or stash at point in the appropriate buffer,
or if that buffer is already being displayed in the current frame
and contains information about that commit or stash, then instead
scroll the buffer down.  If there is no commit or stash at point,
then prompt for a commit.

@kindex q
@cindex magit-log-bury-buffer
@item @kbd{q} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-bury-buffer})

Bury the current buffer or the revision buffer in the same frame.
Like @code{magit-mode-bury-buffer} (which see) but with a negative prefix
argument instead bury the revision buffer, provided it is displayed
in the current frame.

@end table

@defopt magit-log-auto-more

Insert more log entries automatically when moving past the last
entry.  Only considered when moving past the last entry with
@code{magit-goto-*-section} commands.
@end defopt

@table @asis
@kindex +
@cindex magit-log-show-more-commits
@item @kbd{+} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-show-more-commits})

Increase the number of commits shown in current log.

With no prefix argument, show twice as many commits as before.
With a numerical prefix argument, show this many additional
commits.  With a non-numeric prefix argument, show all commits.

When no limit was previously imposed in the current buffer, set the
local limit to the default limit instead (or if that is nil then
100), regardless of the prefix argument.

By default @code{magit-log-cutoff-length} commits are shown.

@end table

@defopt magit-log-show-margin

Whether to initially show the margin in log buffers.

When non-nil the author name and date are initially displayed in the
margin of log buffers.  The margin can be shown or hidden in the
current buffer using the command @code{magit-toggle-margin}.

When a log buffer contains a verbose log, then the margin is never
displayed.  In status buffers this option is ignored, but it is
possible to show the margin using the mentioned command.
@end defopt

@table @asis
@kindex L
@cindex magit-toggle-margin
@item @kbd{L} @tie{}@tie{}@tie{}@tie{}(@code{magit-toggle-margin})

Show or hide the Magit margin.

@end table

@defopt magit-log-cutoff-length

The maximum number of commits to show in log and reflog buffers.
@end defopt

@node Select from log
@subsection Select from log

When the user has to select a recent commit that is reachable from
@code{HEAD}, using regular completion would be inconvenient (because most
humans cannot remember hashes or "HEAD~5", at least not without double
checking).  Instead a log buffer is used to select the commit, which
has the advantage that commits are presented in order and with the
commit message.  The following additional key bindings are available
when a log is used for selection:

@table @asis
@kindex C-c C-c
@cindex magit-log-select-pick
@item @kbd{C-c C-c} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-select-pick})

Select the commit at point and act on it.  Call
@code{magit-log-select-pick-function} with the selected commit as
argument.

@kindex C-c C-k
@cindex magit-log-select-quit
@item @kbd{C-c C-k} @tie{}@tie{}@tie{}@tie{}(@code{magit-log-select-quit})

Abort selecting a commit, don't act on any commit.
@end table

This feature is used by rebase and squash commands.

@node Reflog
@subsection Reflog

Also see 
@ifinfo
@ref{git-reflog,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-reflog">git-reflog(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-reflog(1) manpage
@end iftex
.

These reflog commands are available from the log popup.  See @ref{Logging,Logging}.

@table @asis
@kindex l r
@cindex magit-reflog-current
@item @kbd{l r} @tie{}@tie{}@tie{}@tie{}(@code{magit-reflog-current})

Display the reflog of the current branch.

@kindex l O
@cindex magit-reflog-other
@item @kbd{l O} @tie{}@tie{}@tie{}@tie{}(@code{magit-reflog-other})

Display the reflog of a branch.

@kindex l H
@cindex magit-reflog-head
@item @kbd{l H} @tie{}@tie{}@tie{}@tie{}(@code{magit-reflog-head})

Display the @code{HEAD} reflog.
@end table

@node Diffing
@section Diffing

Also see 
@ifinfo
@ref{git-diff,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-diff">git-diff(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-diff(1) manpage
@end iftex
.

@table @asis
@kindex d
@cindex magit-diff-popup
@item @kbd{d} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex d d
@cindex magit-diff-dwim
@item @kbd{d d} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-dwim})

Show changes for the thing at point.

@kindex d r
@cindex magit-diff
@item @kbd{d r} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff})

Show differences between two commits.

RANGE should be a range (A..B or A@dots{}B) but can also be a single
commit.  If one side of the range is omitted, then it defaults to
HEAD.  If just a commit is given, then changes in the working tree
relative to that commit are shown.

@kindex d w
@cindex magit-diff-worktree
@item @kbd{d w} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-worktree})

Show changes between the current working tree and the @code{HEAD} commit.
With a prefix argument show changes between the working tree and a
commit read from the minibuffer.

@kindex d s
@cindex magit-diff-staged
@item @kbd{d s} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-staged})

Show changes between the index and the @code{HEAD} commit.  With a prefix
argument show changes between the index and a commit read from the
minibuffer.

@kindex d u
@cindex magit-diff-unstaged
@item @kbd{d u} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-unstaged})

Show changes between the working tree and the index.

@kindex d p
@cindex magit-diff-paths
@item @kbd{d p} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-paths})

Show changes between any two files on disk.

@kindex d c
@cindex magit-show-commit
@item @kbd{d c} @tie{}@tie{}@tie{}@tie{}(@code{magit-show-commit})

Show the commit at point.  If there is no commit at point or with a
prefix argument, prompt for a commit.

@kindex d t
@cindex magit-stash-show
@item @kbd{d t} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-show})

Show all diffs of a stash in a buffer.

@kindex M-x magit-diff-unpushed
@cindex magit-diff-unpushed
@item @kbd{M-x magit-diff-unpushed} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-unpushed})

Show unpushed changes.

@kindex M-x magit-diff-unpulled
@cindex magit-diff-unpulled
@item @kbd{M-x magit-diff-unpulled} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-unpulled})

Show unpulled changes.
@end table

@menu
* Refreshing diffs::
* Diff buffer::
* Diff options::
* Revision buffer::
@end menu

@node Refreshing diffs
@subsection Refreshing diffs

The @code{magit-diff-popup} described in the previous section is used to
display a log in the current repositories diff buffer.  The following
popup is used to change the arguments used to generate the diff or
diffs in the current buffer, the status buffer or the diff buffer.

In the diff buffer you can of course just use @code{magit-diff-popup}, but
@code{magit-diff-refresh-popup} is more convenient because you don't have to
again specify which differences to show.  In the status buffer this
popup is the only way to change certain arguments.

@table @asis
@kindex D
@cindex magit-diff-refresh-popup
@item @kbd{D} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-refresh-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex D g
@cindex magit-diff-refresh
@item @kbd{D g} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-refresh})

Set the local diff arguments for the current buffer.

@kindex D s
@cindex magit-diff-set-default-arguments
@item @kbd{D s} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-set-default-arguments})

Set the global diff arguments for the current buffer.

@kindex D w
@cindex magit-diff-save-default-arguments
@item @kbd{D w} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-save-default-arguments})

Set and save the global diff arguments for the current buffer.

@kindex D t
@cindex magit-diff-toggle-refine-hunk
@item @kbd{D t} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-toggle-refine-hunk})

Toggle hunk refinement on or off.
@end table

In addition to the above popup, which allow changing any of the
supported arguments, there also exist some commands which change a
particular argument.

@table @asis
@kindex -
@cindex magit-diff-less-context
@item @kbd{-} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-less-context})

Decrease the context for diff hunks by COUNT lines.

@kindex +
@cindex magit-diff-more-context
@item @kbd{+} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-more-context})

Increase the context for diff hunks by COUNT lines.

@kindex 0
@cindex magit-diff-default-context
@item @kbd{0} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-default-context})

Reset context for diff hunks to the default height.
@end table

While all of the above commands change @strong{how} some change is being
displayed without changing @strong{what} change is being displayed, the
following commands do the opposite: they change what is being
displayed but not how.

@table @asis
@kindex C-c C-d
@cindex magit-diff-while-committing
@item @kbd{C-c C-d} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-while-committing})

While committing, show the changes that are about to be committed.
While amending, invoking the command again toggles between showing
just the new changes or all the changes that will be committed.

This binding is available in the diff buffer as well as the commit
message buffer.

@kindex C-c C-b
@cindex magit-go-backward
@item @kbd{C-c C-b} @tie{}@tie{}@tie{}@tie{}(@code{magit-go-backward})

Move backward in current buffer's history.

@kindex C-c C-f
@cindex magit-go-forward
@item @kbd{C-c C-f} @tie{}@tie{}@tie{}@tie{}(@code{magit-go-forward})

Move forward in current buffer's history.
@end table

@node Diff buffer
@subsection Diff buffer

@table @asis
@kindex RET
@cindex magit-diff-visit-file
@item @kbd{RET} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-visit-file})

From a diff, visit the corresponding file at the appropriate
position.

When the file is already being displayed in another window of the
same frame, then just select that window and adjust point.  With a
prefix argument also display in another window.

If the diff shows changes in the worktree, the index, or @code{HEAD}, then
visit the actual file.  Otherwise when the diff is about an older
commit, then visit the respective blob using @code{magit-find-file}.  Also
see @code{magit-diff-visit-file-worktree}, which, as the name suggests,
always visits the actual file.

@kindex C-<return>
@cindex magit-diff-visit-file-worktree
@item @kbd{C-<return>} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-visit-file-worktree})

From a diff, visit the corresponding file at the appropriate position.

When the file is already being displayed in another window of the
same frame, then just select that window and adjust point.  With
a prefix argument also display in another window.

The actual file in the worktree is visited. The positions in the
hunk headers get less useful the "older" the changes are, and as a
result, jumping to the appropriate position gets less reliable.

Also see @code{magit-diff-visit-file-worktree}, which visits the respective
blob, unless the diff shows changes in the worktree, the index, or
@code{HEAD}.

@kindex j
@cindex magit-jump-to-diffstat-or-diff
@item @kbd{j} @tie{}@tie{}@tie{}@tie{}(@code{magit-jump-to-diffstat-or-diff})

Jump to the diffstat or diff.  When point is on a file inside the
diffstat section, then jump to the respective diff section.
Otherwise, jump to the diffstat section or a child thereof.

@kindex SPC
@cindex scroll-up
@item @kbd{SPC} @tie{}@tie{}@tie{}@tie{}(@code{scroll-up})

Scroll text upward.

@kindex DEL
@cindex scroll-down
@item @kbd{DEL} @tie{}@tie{}@tie{}@tie{}(@code{scroll-down})

Scroll text downward.
@end table

@node Diff options
@subsection Diff options

@defopt magit-diff-show-diffstat

Whether to show diffstat in diff buffers.
@end defopt

@defopt magit-diff-show-xref-buttons

Whether to show buffer history buttons in diff buffers.
@end defopt

@defopt magit-diff-auto-show

Whether to automatically show the relevant diff or commit.

When this option is non-nil certain operations cause the relevant
changes to be displayed automatically.

@itemize
@item
@code{commit}

@item
@code{stage-all}

@item
@code{log-oneline}

@item
@code{log-follow}

@item
@code{log-select}

@item
@code{blame-follow}
@end itemize
In the event that expanding very large patches takes a long time, @code{C-g}
can be used to abort that step.  This is especially useful when you
would normally not look at the changes, e.g. because you are
committing some binary files.
@end defopt

@defopt magit-diff-refine-hunk

Whether to show word-granularity differences within diff hunks.

@itemize
@item
@code{nil} never show fine differences.

@item
@code{t} show fine differences for the current diff hunk only.

@item
@code{all} show fine differences for all displayed diff hunks.
@end itemize
@end defopt

@defopt magit-diff-paint-whitespace

Specify where to highlight whitespace errors.

See @code{magit-highlight-trailing-whitespace},
@code{magit-highlight-indentation}.  The symbol @code{t} means in all diffs,
@code{status} means only in the status buffer, and nil means nowhere.
@end defopt

@defopt magit-diff-highlight-trailing

Whether to highlight whitespace at the end of a line in diffs.  Used
only when @code{magit-diff-paint-whitespace} is non-nil.
@end defopt

@defopt magit-diff-highlight-indentation

Highlight the "wrong" indentation style.  Used only when
@code{magit-diff-paint-whitespace} is non-nil.

The value is a list of cons cells.  The car is a regular expression,
and the cdr is the value that applies to repositories whose
directory matches the regular expression.  If more than one element
matches, then the @strong{last} element in the list applies.  The default
value should therefore come first in the list.

If the value is @code{tabs}, highlight indentation with tabs.  If the value
is an integer, highlight indentation with at least that many spaces.
Otherwise, highlight neither.
@end defopt

@node Revision buffer
@subsection Revision buffer

@defopt magit-revision-show-diffstat

Whether to show diffstat in revision buffers.
@end defopt

@defopt magit-revision-show-notes

Whether to show notes in revision buffers.
@end defopt

@defopt magit-revision-show-xref-buttons

Whether to show buffer history buttons in revision buffers.
@end defopt

@defopt magit-revision-insert-related-refs

Whether to show related refs in revision buffers.
@end defopt

@node Ediffing
@section Ediffing

@table @asis
@kindex e
@cindex magit-ediff-dwim
@item @kbd{e} @tie{}@tie{}@tie{}@tie{}(@code{magit-ediff-dwim})

Compare, stage, or resolve using Ediff.

This command tries to guess what file, and what commit or range the
user wants to compare, stage, or resolve using Ediff.  It might only
be able to guess either the file, or range/commit, in which case
the user is asked about the other.  It might not always guess right,
in which case the appropriate @code{magit-ediff-*} command has to be used
explicitly.  If it cannot read the user's mind at all, then it asks
the user for a command to run.

@kindex E
@cindex magit-ediff-popup
@item @kbd{E} @tie{}@tie{}@tie{}@tie{}(@code{magit-ediff-popup})

This prefix commands shows the following suffix commands in a popup
buffer.

@kindex E d
@cindex magit-ediff-compare
@item @kbd{E d} @tie{}@tie{}@tie{}@tie{}(@code{magit-ediff-compare})

Compare two revisions of a file using Ediff, defaulting to the file
at point.

@kindex E m
@cindex magit-ediff-resolve
@item @kbd{E m} @tie{}@tie{}@tie{}@tie{}(@code{magit-ediff-resolve})

Resolve outstanding conflicts in a file using Ediff, defaulting to
the file at point.

In the rare event that you want to manually resolve all conflicts,
including those already resolved by Git, use
@code{ediff-merge-revisions-with-ancestor}.

@kindex E s
@cindex magit-ediff-stage
@item @kbd{E s} @tie{}@tie{}@tie{}@tie{}(@code{magit-ediff-stage})

Stage and unstage changes to a file using Ediff, defaulting to the
file at point.
@end table

@node References buffer
@section References buffer

@table @asis
@kindex y
@cindex magit-show-refs-popup
@item @kbd{y} @tie{}@tie{}@tie{}@tie{}(@code{magit-show-refs-popup})

List and compare references in a dedicated buffer.  By default all
refs are compared with @code{HEAD}, but with a prefix argument this command
instead acts as a prefix command and shows the following suffix
commands along with the appropriate infix arguments in a popup
buffer.

@kindex y y
@cindex magit-show-refs-head
@item @kbd{y y} @tie{}@tie{}@tie{}@tie{}(@code{magit-show-refs-head})

List and compare references in a dedicated buffer.  Refs are
compared with @code{HEAD}.

@kindex y c
@cindex magit-show-refs-current
@item @kbd{y c} @tie{}@tie{}@tie{}@tie{}(@code{magit-show-refs-current})

List and compare references in a dedicated buffer.  Refs are
compared with the current branch or @code{HEAD} if it is detached.

@kindex y o
@cindex magit-show-refs
@item @kbd{y o} @tie{}@tie{}@tie{}@tie{}(@code{magit-show-refs})

List and compare references in a dedicated buffer.  Refs are
compared with a branch read from the user.

@end table

@defopt magit-refs-show-commit-count

Whether to show commit counts in Magit-Refs mode buffers.

@itemize
@item
@verb{~all~} Show counts for branches and tags.

@item
@code{branch} Show counts for branches only.

@item
@code{nil} Never show counts.
@end itemize
The default is @code{nil} because anything else can be very expensive.
@end defopt

@defopt magit-refs-show-margin

Whether to initially show the margin in refs buffers.

When non-nil the committer name and date are initially displayed in
the margin of refs buffers.  The margin can be shown or hidden in
the current buffer using the command @code{magit-toggle-margin}.
@end defopt

The following variables control how individual refs are displayed.  If
you change one of these variables (especially the "%c" part), then you
should also change the others to keep things aligned.  The following
%-sequences are supported:

@itemize
@item
@code{%a} Number of commits this ref has over the one we compare to.

@item
@code{%b} Number of commits the ref we compare to has over this one.

@item
@code{%c} Number of commits this ref has over the one we compare to.  For
the ref which all other refs are compared this is instead "@@", if
it is the current branch, or "#" otherwise.

@item
@code{%C} For the ref which all other refs are compared this is "@@", if it
is the current branch, or "#" otherwise.  For all other refs " ".

@item
@code{%h} Hash of this ref's tip.

@item
@code{%m} Commit summary of the tip of this ref.

@item
@code{%n} Name of this ref.

@item
@code{%u} Upstream of this local branch and additional local vs. upstream
information.

@item
@code{%U} Upstream of this local branch.

@end itemize

@defvar magit-refs-local-branch-format

Format used for local branches in refs buffers.
@end defvar

@defvar magit-refs-remote-branch-format

Format used for remote branches in refs buffers.
@end defvar

@defvar magit-refs-tags-format

Format used for tags in refs buffers.
@end defvar

@defvar magit-refs-indent-cherry-lines

Indentation of cherries in refs buffers.  This should be N-1 where N
is taken from "%Nc" in the above format strings.
@end defvar

@menu
* References sections::
@end menu

@node References sections
@subsection References sections

The contents of references buffers is controlled using the hook
@code{magit-refs-sections-hook}.  See @ref{Section hooks,Section hooks} to learn about such hooks
and how to customize them.  All of the below functions are members of
the default value.  Note that it makes much less sense to customize
this hook than it does for the respective hook used for the status
buffer.

@defopt magit-refs-sections-hook

Hook run to insert sections into a references buffer.
@end defopt

@defun magit-insert-local-branches

Insert sections showing all local branches.
@end defun

@defun magit-insert-remote-branches

Insert sections showing all remote-tracking branches.
@end defun

@defun magit-insert-tags

Insert sections showing all tags.
@end defun

@node Bisecting
@section Bisecting

Also see 
@ifinfo
@ref{git-bisect,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-bisect">git-bisect(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-bisect(1) manpage
@end iftex
.

@table @asis
@kindex B
@cindex magit-bisect-popup
@item @kbd{B} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-popup})

This prefix commands shows the following suffix commands in a
popup buffer.
@end table

When bisecting is not in progress, then the popup buffer features the
following commands.

@table @asis
@kindex B s
@cindex magit-bisect-start
@item @kbd{B s} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-start})

Start a bisect session.

Bisecting a bug means to find the commit that introduced it.
This command starts such a bisect session by asking for a known
good and a bad commit.

@kindex B u
@cindex magit-bisect-run
@item @kbd{B u} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-run})

Bisect automatically by running commands after each step.
@end table

When bisecting is in progress, then the popup buffer features these
commands instead.

@table @asis
@kindex B b
@cindex magit-bisect-bad
@item @kbd{B b} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-bad})

Mark the current commit as bad.  Use this after you have asserted
that the commit does contain the bug in question.

@kindex B g
@cindex magit-bisect-good
@item @kbd{B g} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-good})

Mark the current commit as good.  Use this after you have asserted
that the commit does not contain the bug in question.

@kindex B k
@cindex magit-bisect-skip
@item @kbd{B k} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-skip})

Skip the current commit.  Use this if for some reason the current
commit is not a good one to test.  This command lets Git choose a
different one.

@kindex B r
@cindex magit-bisect-reset
@item @kbd{B r} @tie{}@tie{}@tie{}@tie{}(@code{magit-bisect-reset})

After bisecting, cleanup bisection state and return to original
@code{HEAD}.
@end table

@node Visiting blobs
@section Visiting blobs

@table @asis
@kindex M-x magit-find-file
@cindex magit-find-file
@item @kbd{M-x magit-find-file} @tie{}@tie{}@tie{}@tie{}(@code{magit-find-file})

View FILE from REV.  Switch to a buffer visiting blob REV:FILE,
creating one if none already exists.

@kindex M-x magit-find-file-other-window
@cindex magit-find-file-other-window
@item @kbd{M-x magit-find-file-other-window} @tie{}@tie{}@tie{}@tie{}(@code{magit-find-file-other-window})

View FILE from REV, in another window.  Like @code{magit-find-file}, but
create a new window or reuse an existing one.
@end table

@node Blaming
@section Blaming

Also see 
@ifinfo
@ref{git-blame,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-blame">git-blame(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-blame(1) manpage
@end iftex
.

@table @asis
@kindex M-x magit-blame
@cindex magit-blame
@item @kbd{M-x magit-blame} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame})

Display edit history of FILE up to REVISION.

Interactively blame the file being visited in the current buffer.
If the buffer visits a revision of that file, then blame up to that
revision.  Otherwise, blame the file's full history, including
uncommitted changes.

If Magit-Blame mode is already turned on then blame recursively, by
visiting REVISION:FILE (using @code{magit-find-file}), where revision is
the revision before the revision that added the lines at point.

ARGS is a list of additional arguments to pass to @code{git blame}; only
arguments available from @code{magit-blame-popup} should be used.

@kindex M-x magit-blame-popup
@cindex magit-blame-popup
@item @kbd{M-x magit-blame-popup} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-popup})

By default this behaves just like @code{magit-blame}.  With a prefix
argument instead show a popup buffer featuring a few infix arguments
and a single suffix command (@code{magit-blame}).

@kindex RET
@cindex magit-show-commit
@item @kbd{RET} @tie{}@tie{}@tie{}@tie{}(@code{magit-show-commit})

Show the commit at point.  If there is no commit at point or with a
prefix argument, prompt for a commit.

@kindex SPC
@cindex magit-diff-show-or-scroll-up
@item @kbd{SPC} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-show-or-scroll-up})

Update the commit or diff buffer for the thing at point.

Either show the commit or stash at point in the appropriate buffer,
or if that buffer is already being displayed in the current frame
and contains information about that commit or stash, then instead
scroll the buffer up.  If there is no commit or stash at point, then
prompt for a commit.

@kindex DEL
@cindex magit-diff-show-or-scroll-down
@item @kbd{DEL} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-show-or-scroll-down})

Update the commit or diff buffer for the thing at point.

Either show the commit or stash at point in the appropriate buffer,
or if that buffer is already being displayed in the current frame
and contains information about that commit or stash, then instead
scroll the buffer down.  If there is no commit or stash at point,
then prompt for a commit.

@kindex n
@cindex magit-blame-next-chunk
@item @kbd{n} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-next-chunk})

Move to the next chunk.

@kindex N
@cindex magit-blame-next-chunk-same-commit
@item @kbd{N} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-next-chunk-same-commit})

Move to the next chunk from the same commit.

@kindex p
@cindex magit-blame-previous-chunk
@item @kbd{p} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-previous-chunk})

Move to the previous chunk.

@kindex P
@cindex magit-blame-previous-chunk-same-commit
@item @kbd{P} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-previous-chunk-same-commit})

Move to the previous chunk from the same commit.

@kindex q
@cindex magit-blame-quit
@item @kbd{q} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-quit})

Turn off Magit-Blame mode.  If the buffer was created during a
recursive blame, then also kill the buffer.

@kindex t
@cindex magit-blame-toggle-headings
@item @kbd{t} @tie{}@tie{}@tie{}@tie{}(@code{magit-blame-toggle-headings})

Show or hide blame chunk headings.

@end table

@defopt magit-blame-heading-format

Format string used for blame headings.
@end defopt

@defopt magit-blame-time-format

Format string used for time strings in blame headings.
@end defopt

@defopt magit-blame-show-headings

Whether to initially show blame block headings.  The headings can
also be toggled locally using command @verb{~magit-blame-toggle-headings~}.
@end defopt

@defopt magit-blame-goto-chunk-hook

Hook run by @code{magit-blame-next-chunk} and @code{magit-blame-previous-chunk}.
@end defopt

@node Manipulating
@chapter Manipulating


@menu
* Repository setup::
* Staging and unstaging::
* Applying::
* Committing::
* Branching::
* Merging::
* Rebasing::
* Cherry picking::
* Resetting::
* Stashing::
@end menu

@node Repository setup
@section Repository setup

@table @asis
@kindex M-x magit-init
@cindex magit-init
@item @kbd{M-x magit-init} @tie{}@tie{}@tie{}@tie{}(@code{magit-init})

Initialize a Git repository, then show its status.

If the directory is below an existing repository, then the user has
to confirm that a new one should be created inside.  If the
directory is the root of the existing repository, then the user has
to confirm that it should be reinitialized.

@kindex M-x magit-clone
@cindex magit-clone
@item @kbd{M-x magit-clone} @tie{}@tie{}@tie{}@tie{}(@code{magit-clone})

Clone a repository.  The user is queried for a remote url and a
local directory.
@end table

@node Staging and unstaging
@section Staging and unstaging

Like Git, Magit can of course stage and unstage complete files.
Unlike Git, it also allows users to gracefully un-/stage
individual hunks and even just part of a hunk.  To stage individual
hunks and parts of hunks using Git directly, one has to use the very
modal and rather clumsy interface of a @code{git add --interactive} session.

With Magit, on the other hand, one can un-/stage individual hunks by
just moving point into the respective section inside a diff displayed
in the status buffer or a separate diff buffer and typing @code{s} or @code{u}.  To
operate on just parts of a hunk, mark the changes that should be
un-/staged using the region and then press the same key that would be
used to un-/stage.  To stage multiple files or hunks at once use a
region that starts inside the heading of such a section and ends
inside the heading of a sibling section of the same type.

Besides staging and unstaging, Magit also provides several other
"apply variants" that can also operate on a file, multiple files at
once, a hunk, multiple hunks at once, and on parts of a hunk.  These
apply variants are described in the next section.

@table @asis
@kindex s
@cindex magit-stage
@item @kbd{s} @tie{}@tie{}@tie{}@tie{}(@code{magit-stage})

Add the change at point to the staging area.

@kindex S
@cindex magit-stage-modified
@item @kbd{S} @tie{}@tie{}@tie{}@tie{}(@code{magit-stage-modified})

Stage all changes to files modified in the worktree.  Stage all new
content of tracked files and remove tracked files that no longer
exist in the working tree from the index also.  With a prefix
argument also stage previously untracked (but not ignored) files.

@kindex u
@cindex magit-unstage
@item @kbd{u} @tie{}@tie{}@tie{}@tie{}(@code{magit-unstage})

Remove the change at point from the staging area.

@kindex U
@cindex magit-reset-index
@item @kbd{U} @tie{}@tie{}@tie{}@tie{}(@code{magit-reset-index})

Reset the index to some commit.  The commit is read from the user
and defaults to the commit at point.  If there is no commit at
point, then it defaults to @code{HEAD}.

So @code{U RET} with no commit at point does the inverse of @code{S} (or actually
@code{S yes RET}), i.e. "unstage all staged changes".  If you would rather
use a command which always does just that, then rebind @code{U} to
@code{magit-unstage-all}.

@kindex M-x magit-unstage-all
@cindex magit-unstage-all
@item @kbd{M-x magit-unstage-all} @tie{}@tie{}@tie{}@tie{}(@code{magit-unstage-all})

Remove all changes from the staging area.
@end table

@menu
* Staging from file-visiting buffers::
@end menu

@node Staging from file-visiting buffers
@subsection Staging from file-visiting buffers

Fine-grained un-/staging has to be done from the status or a diff
buffer, but it's also possible to un-/stage all changes made to the
file visited in the current buffer right from inside that buffer.

@table @asis
@kindex M-x magit-stage-file
@cindex magit-stage-file
@item @kbd{M-x magit-stage-file} @tie{}@tie{}@tie{}@tie{}(@code{magit-stage-file})

When invoked inside a file-visiting buffer, then stage all changes
to that file.  In a Magit buffer, stage the file at point if any.
Otherwise prompt for a file to be staged.  With a prefix argument
always prompt the user for a file, even in a file-visiting buffer or
when there is a file section at point.

@kindex M-x magit-unstage-file
@cindex magit-unstage-file
@item @kbd{M-x magit-unstage-file} @tie{}@tie{}@tie{}@tie{}(@code{magit-unstage-file})

When invoked inside a file-visiting buffer, then unstage all changes
to that file.  In a Magit buffer, unstage the file at point if any.
Otherwise prompt for a file to be unstaged.  With a prefix argument
always prompt the user for a file, even in a file-visiting buffer or
when there is a file section at point.
@end table

@node Applying
@section Applying

Magit provides several "apply variants": stage, unstage, discard,
reverse, and "regular apply".  At least when operating on a hunk they
are all implemented using @code{git apply}, which is why they are called
"apply variants".

@itemize
@item
Stage.  Apply a change from the working tree to the index.  The change
also remains in the working tree.


@item
Unstage.  Remove a change from the index.  The change remains in the
working tree.


@item
Discard.  On a staged change, remove it from the working tree and the
index.  On an unstaged change, remove it from the working tree only.


@item
Reverse.  Reverse a change in the working tree.  Both committed and
staged changes can be reversed.  Unstaged changes cannot be
reversed.  Discard them instead.


@item
Apply.  Apply a change to the working tree.  Both committed and staged
changes can be applied.  Unstaged changes cannot be applied - as
they already have been applied.
@end itemize

The previous section described the staging and unstaging commands.
What follows are the commands which implement the remaining apply
variants.

@table @asis
@kindex a
@cindex magit-apply
@item @kbd{a} @tie{}@tie{}@tie{}@tie{}(@code{magit-apply})

Apply the change at point to the working tree.  With a prefix argument
and if necessary, attempt a 3-way merge.

@kindex k
@cindex magit-discard
@item @kbd{k} @tie{}@tie{}@tie{}@tie{}(@code{magit-discard})

Remove the change at point from the working tree.

@kindex v
@cindex magit-reverse
@item @kbd{v} @tie{}@tie{}@tie{}@tie{}(@code{magit-reverse})

Reverse the change at point in the working tree.
@end table

@node Committing
@section Committing

When the user initiates a commit, Magit calls @code{git commit} without any
arguments, so Git has to get it from the user.  It creates the file
@code{.git/COMMIT_EDITMSG} and then opens that file in an editor.  Magit
arranges for that editor to be the Emacsclient.  Once the user
finishes the editing session, the Emacsclient exits and Git creates the
commit using the file's content as message.

@menu
* Initiating a commit::
* Editing commit messages::
@end menu

@node Initiating a commit
@subsection Initiating a commit

Also see 
@ifinfo
@ref{git-commit,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-commit">git-commit(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-commit(1) manpage
@end iftex
.

@table @asis
@kindex c
@cindex magit-commit-popup
@item @kbd{c} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex c c
@cindex magit-commit
@item @kbd{c c} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit})

Create a new commit on @code{HEAD}.  With a prefix argument amend to the
commit at @code{HEAD} instead.

@kindex c a
@cindex magit-commit-amend
@item @kbd{c a} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-amend})

Amend the last commit.

@kindex c e
@cindex magit-commit-extend
@item @kbd{c e} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-extend})

Amend the last commit, without editing the message.  With a prefix
argument change the committer date.  The option
@code{magit-commit-extend-override-date} can be used to inverse the
meaning of the prefix argument.

@kindex c r
@cindex magit-commit-reword
@item @kbd{c r} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-reword})

Reword the last commit, ignoring staged changes.

With a prefix argument change the committer date.  The option
@code{magit-commit-rewrite-override-date} can be used to inverse the
meaning of the prefix argument.

Non-interactively respect the optional OVERRIDE-DATE argument and
ignore the option.

@kindex c f
@cindex magit-commit-fixup
@item @kbd{c f} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-fixup})

Create a fixup commit.  With a prefix argument the target commit has
to be confirmed.  Otherwise the commit at point may be used without
confirmation depending on the value of option
@code{magit-commit-squash-confirm}.

@kindex c F
@cindex magit-commit-instant-fixup
@item @kbd{c F} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-instant-fixup})

Create a fixup commit and instantly rebase.

@kindex c s
@cindex magit-commit-squash
@item @kbd{c s} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-squash})

Create a squash commit.  With a prefix argument the target commit
has to be confirmed.  Otherwise the commit at point may be used
without confirmation depending on the value of option
@code{magit-commit-squash-confirm}.

@kindex c S
@cindex magit-commit-instant-squash
@item @kbd{c S} @tie{}@tie{}@tie{}@tie{}(@code{magit-commit-instant-squash})

Create a squash commit and instantly rebase.

@end table

@defopt magit-commit-ask-to-stage

Whether to ask to stage everything when committing and nothing is
staged.
@end defopt

@defopt magit-commit-extend-override-date

Whether using @code{magit-commit-extend} changes the committer date.
@end defopt

@defopt magit-commit-reword-override-date

Whether using @code{magit-commit-reword} changes the committer date.
@end defopt

@defopt magit-commit-squash-confirm

Whether the commit targeted by squash and fixup has to be confirmed.
When non-nil then the commit at point (if any) is used as default
choice.  Otherwise it has to be confirmed.  This option only affects
@code{magit-commit-squash} and @code{magit-commit-fixup}.  The "instant" variants
always require confirmation because making an error while using
those is harder to recover from.
@end defopt

@node Editing commit messages
@subsection Editing commit messages

After initiating a commit as described in the previous section, two new
buffers appear.  One shows the changes that are about to committed,
while the other is used to write the message.  All regular editing
commands are available in the commit message buffer.  This section
only describes the additional commands.

Commit messages are edited in an edit session - in the background Git
is waiting for the editor, in our case the Emacsclient, to save the
commit message in a file (in most cases @code{.git/COMMIT_EDITMSG}) and then
return.  If the Emacsclient returns with a non-zero exit status then
Git does not create the commit.  So the most important commands are
those for finishing and aborting the commit.

@table @asis
@kindex C-c C-c
@cindex with-editor-finish
@item @kbd{C-c C-c} @tie{}@tie{}@tie{}@tie{}(@code{with-editor-finish})

Finish the current editing session by returning with exit code 0.
Git then creates the commit using the message it finds in the file.

@kindex C-c C-k
@cindex with-editor-cancel
@item @kbd{C-c C-k} @tie{}@tie{}@tie{}@tie{}(@code{with-editor-cancel})

Cancel the current editing session by returning with exit code 1.
Git then cancels the commit, but leaves the file untouched.
@end table

In additon to being used by Git, these messages may also be stored in
a ring that persists until Emacs is closed.  By default the message is
stored at the beginning and the end of an edit session (regardless of
whether the session is finished successfully or was canceled).  It is
sometimes useful to bring back messages from that ring.

@table @asis
@kindex C-s M-s
@cindex git-commit-save-message
@item @kbd{C-s M-s} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-save-message})

Save the current buffer content to the commit message ring.

@kindex M-p
@cindex git-commit-prev-message
@item @kbd{M-p} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-prev-message})

Cycle backward through the commit message ring, after saving the
current message to the ring.  With a numeric prefix ARG, go back
ARG comments.

@kindex M-n
@cindex git-commit-next-message
@item @kbd{M-n} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-next-message})

Cycle forward through the commit message ring, after saving the
current message to the ring.  With a numeric prefix ARG, go back
ARG comments.
@end table

By default the diff for the changes that are about to be committed are
automatically shown when invoking the commit.  When amending to an
existing commit it may be useful to show either the changes that are
about to be added to that commit or to show those changes together
with those that are already committed.

@table @asis
@kindex C-c C-d
@cindex magit-diff-while-committing
@item @kbd{C-c C-d} @tie{}@tie{}@tie{}@tie{}(@code{magit-diff-while-committing})

While committing, show the changes that are about to be committed.
While amending, invoking the command again toggles between showing
just the new changes or all the changes that will be committed.
@end table

Some projects use pseudo headers in commit messages.  Magit colorizes
such headers and provides some commands to insert such headers.

@defopt git-commit-known-pseudo-headers

A list of Git pseudo headers to be highlighted.
@end defopt

@table @asis
@kindex C-c C-a
@cindex git-commit-ack
@item @kbd{C-c C-a} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-ack})

Insert a header acknowledging that you have looked at the commit.

@kindex C-c C-r
@cindex git-commit-review
@item @kbd{C-c C-r} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-review})

Insert a header acknowledging that you have reviewed the commit.

@kindex C-c C-s
@cindex git-commit-signoff
@item @kbd{C-c C-s} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-signoff})

Insert a header to sign off the commit.

@kindex C-c C-t
@cindex git-commit-test
@item @kbd{C-c C-t} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-test})

Insert a header acknowledging that you have tested the commit.

@kindex C-c C-o
@cindex git-commit-cc
@item @kbd{C-c C-o} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-cc})

Insert a header mentioning someone who might be interested.

@kindex C-c C-p
@cindex git-commit-reported
@item @kbd{C-c C-p} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-reported})

Insert a header mentioning the person who reported the issue being
fixed by the commit.

@kindex C-c C-i
@cindex git-commit-suggested
@item @kbd{C-c C-i} @tie{}@tie{}@tie{}@tie{}(@code{git-commit-suggested})

Insert a header mentioning the person who suggested the change.
@end table

@code{git-commit-mode} is a minor mode that is only used to establish
the above key bindings.  This allows using an arbitrary major mode
when editing the commit message.  It's even possible to use a
different major mode in different repositories, which is useful when
different projects impose different commit message conventions.

@defopt git-commit-major-mode

The value of this option is the major mode used to edit Git commit
messages.
@end defopt

Because @code{git-commit-mode} is a minor mode, we don't use its mode hook
to setup the buffer, except for the key bindings.  All other setup
happens in the function @code{git-commit-setup}, which among other things runs
the hook @code{git-commit-setup-hook}.  The following functions are suitable
for that hook.

@defopt git-commit-setup-hook

Hook run at the end of @code{git-commit-setup}.
@end defopt

@defun magit-revert-buffers &optional force

Revert unmodified file-visiting buffers of the current repository.

If either @code{magit-revert-buffers} is non-nil and @code{inhibit-magit-revert}
is nil, or if optional FORCE is non-nil, then revert all unmodified
buffers that visit files being tracked in the current repository.
@end defun

@defun git-commit-save-message

Save the current buffer content to the commit message ring.
@end defun

@defun git-commit-setup-changelog-support

After this function is called, ChangeLog entries are treated as
paragraphs.
@end defun

@defun git-commit-turn-on-auto-fill

Turn on @code{auto-fill-mode} and set @code{fill-column} to the value of
@code{git-commit-fill-column}.
@end defun

@defun git-commit-turn-on-flyspell

Turn on Flyspell mode.  Also prevent comments from being checked and
finally check current non-comment text.
@end defun

@defun git-commit-propertize-diff

Propertize the diff shown inside the commit message buffer.  Git
inserts such diffs into the commit message template when the
@code{--verbose} argument is used.  Magit's commit popup by default does
not offer that argument because the diff that is shown in a separate
buffer is more useful.  But some users disagree, which is why this
function exists.
@end defun

@defun with-editor-usage-message

Show usage information in the echo area.
@end defun

Magit also helps with writing @strong{good} commit messages by complaining when
certain rules are violated.

@defopt git-commit-summary-max-length

The intended maximal length of the summary line of commit messages.
Characters beyond this column are colorized to indicate that this
preference has been violated.
@end defopt

@defopt git-commit-fill-column

Column beyond which automatic line-wrapping should happen in commit
message buffers.
@end defopt

@defopt git-commit-finish-query-functions

List of functions called to query before performing commit.

The commit message buffer is current while the functions are called.
If any of them returns nil, then the commit is not performed and the
buffer is not killed.  The user should then fix the issue and try
again.

The functions are called with one argument.  If it is non-nil then
that indicates that the user used a prefix argument to force
finishing the session despite issues.  Functions should usually
honor this wish and return non-nil.
@end defopt

@defun git-commit-check-style-conventions

Check for violations of certain basic style conventions.  For each
violation ask the user if she wants to proceed anyway.  This makes
sure the summary line isn't too long and that the second line is
empty.
@end defun

To show no diff while committing remove @code{magit-commit-diff} from
@code{server-switch-hook}.

@node Branching
@section Branching

Also see 
@ifinfo
@ref{git-branch,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-branch">git-branch(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-branch(1) manpage
@end iftex
 and 
@ifinfo
@ref{git-checkout,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-checkout">git-checkout(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-checkout(1) manpage
@end iftex
.

@table @asis
@kindex b
@cindex magit-branch-popup
@item @kbd{b} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex b b
@cindex magit-checkout
@item @kbd{b b} @tie{}@tie{}@tie{}@tie{}(@code{magit-checkout})

Checkout a revision read in the minibuffer and defaulting to the
branch or arbitrary revision at point.  If the revision is a local
branch then that becomes the current branch.  If it is something
else then @code{HEAD} becomes detached.  Checkout fails if the working tree
or the staging area contain changes.

@kindex b c
@cindex magit-branch
@item @kbd{b c} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch})

Create a new branch.  The user is asked for a branch or arbitrary
revision to use as the starting point of the new branch.  When a
branch name is provided, then that becomes the upstream branch of
the new branch.  The name of the new branch is also read in the
minibuffer.

@kindex b B
@cindex magit-branch-and-checkout
@item @kbd{b B} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-and-checkout})

This command creates a new branch like @code{magit-branch}, but then also
checks it out.

@kindex b d
@cindex magit-branch-delete
@item @kbd{b d} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-delete})

Delete one or multiple branches.  If the region marks multiple
branches, then offer to delete those.  Otherwise, prompt for a single
branch to be deleted, defaulting to the branch at point.

@kindex b u
@cindex magit-branch-set-upstream
@item @kbd{b u} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-set-upstream})

Change the upstream branch of a branch.  Both branches are read in
the minibuffer, while providing reasonable defaults.

@kindex b U
@cindex magit-branch-unset-upstream
@item @kbd{b U} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-unset-upstream})

Unset the upstream branch of a branch read in the minibuffer and
defaulting to the branch at point or the current branch.

@kindex b r
@cindex magit-branch-rename
@item @kbd{b r} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-rename})

Rename a branch.  The branch and the new name are read in the
minibuffer.  With prefix argument the branch is renamed even if that
name conflicts with an existing branch.

@kindex b e
@cindex magit-branch-edit-description
@item @kbd{b e} @tie{}@tie{}@tie{}@tie{}(@code{magit-branch-edit-description})

Edit the description of a branch.  The branch is read in the
minibuffer defaulting to the branch at point or the current branch.
The description is edited in a regular buffer similar to how commit
messages are edited.
@end table

@node Merging
@section Merging

Also see 
@ifinfo
@ref{git-merge,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-merge">git-merge(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-merge(1) manpage
@end iftex
.

@table @asis
@kindex m
@cindex magit-merge-popup
@item @kbd{m} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
@end table

When no merge is in progress, then the popup buffer features the
following commands.

@table @asis
@kindex m m
@cindex magit-merge
@item @kbd{m m} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge})

Merge another branch or an arbitrary revision into the current
branch.  The branch or revision to be merged is read in the
minibuffer and defaults to the one at point.

Unless there are conflicts or a prefix argument is used, the
resulting merge commit uses a generic commit message, and the user
does not get a chance to inspect or change it before the commit is
created.  With a prefix argument this does not actually create the
merge commit, which makes it possible to inspect how conflicts were
resolved and to adjust the commit message.

@kindex m e
@cindex magit-merge-editmsg
@item @kbd{m e} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge-editmsg})

Merge another branch or an arbitrary revision into the current
branch and open a commit message buffer, so that the user can make
adjustments.  The commit is not actually created until the user
finishes with @code{C-c C-c}.

@kindex m n
@cindex magit-merge-nocommit
@item @kbd{m n} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge-nocommit})

Merge another branch or an arbitrary revision into the current
branch, but do not actually create the commit.  The user can then
further adjust the merge, even when automatic conflict resolution
succeeded and/or adjust the commit message.

@kindex m p
@cindex magit-merge-preview
@item @kbd{m p} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge-preview})

Preview result of merging another branch or an arbitrary revision
into the current branch.
@end table

When a merge is in progress, then the popup buffer features these
commands instead.

@table @asis
@kindex m m
@cindex magit-merge
@item @kbd{m m} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge})

After resolving conflicts, proceed with the merge.  If there are
still conflicts, then this fails.

@kindex m a
@cindex magit-merge-abort
@item @kbd{m a} @tie{}@tie{}@tie{}@tie{}(@code{magit-merge-abort})

Abort the current merge operation.
@end table

@node Rebasing
@section Rebasing

Also see 
@ifinfo
@ref{git-rebase,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-rebase">git-rebase(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-rebase(1) manpage
@end iftex
.

@table @asis
@kindex r
@cindex magit-rebase-popup
@item @kbd{r} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
@end table

When no rebase is in progress, then the popup buffer features the
following commands.

@table @asis
@kindex r r
@cindex magit-rebase
@item @kbd{r r} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase})

Start a non-interactive rebase sequence.  All commits not in
UPSTREAM are rebased.

@kindex r o
@cindex magit-rebase-from
@item @kbd{r o} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-from})

Start a non-interactive rebase sequence with commits from START to
@code{HEAD} onto NEWBASE.  START has to be selected from a list of recent
commits.

@kindex r e
@cindex magit-rebase-interactive
@item @kbd{r e} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-interactive})

Start an interactive rebase sequence.

@kindex r f
@cindex magit-rebase-autosquash
@item @kbd{r f} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-autosquash})

Combine squash and fixup commits with their intended targets.

@kindex r s
@cindex magit-rebase-edit-commit
@item @kbd{r s} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-edit-commit})

Edit a single older commit using rebase.

@kindex r w
@cindex magit-rebase-reword-commit
@item @kbd{r w} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-reword-commit})

Reword a single older commit using rebase.
@end table

When a rebase is in progress, then the popup buffer features these
commands instead.

@table @asis
@kindex r r
@cindex magit-rebase-continue
@item @kbd{r r} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-continue})

Restart the current rebasing operation.

@kindex r s
@cindex magit-rebase-skip
@item @kbd{r s} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-skip})

Skip the current commit and restart the current rebase operation.

@kindex r e
@cindex magit-rebase-edit
@item @kbd{r e} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-edit})

Edit the todo list of the current rebase operation.

@kindex r a
@cindex magit-rebase-abort
@item @kbd{r a} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-abort})

Abort the current rebase operation, restoring the original branch.
@end table

@menu
* Editing rebase sequences::
@end menu

@node Editing rebase sequences
@subsection Editing rebase sequences

@table @asis
@kindex C-c C-c
@cindex with-editor-finish
@item @kbd{C-c C-c} @tie{}@tie{}@tie{}@tie{}(@code{with-editor-finish})

Finish the current editing session by returning with exit code 0.
Git then creates the commit using the message it finds in the file.

@kindex C-c C-k
@cindex with-editor-cancel
@item @kbd{C-c C-k} @tie{}@tie{}@tie{}@tie{}(@code{with-editor-cancel})

Cancel the current editing session by returning with exit code 1.
Git then cancels the commit, but leaves the file untouched.

@kindex RET
@cindex git-rebase-show-commit
@item @kbd{RET} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-show-commit})

Show the commit on the current line if any.

@kindex p
@cindex git-rebase-backward-line
@item @kbd{p} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-backward-line})

Move to previous line.

@kindex n
@cindex forward-line
@item @kbd{n} @tie{}@tie{}@tie{}@tie{}(@code{forward-line})

Move to next line.

@kindex M-p
@cindex git-rebase-move-line-up
@item @kbd{M-p} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-move-line-up})

Move the current commit (or command) up.

@kindex M-n
@cindex git-rebase-move-line-down
@item @kbd{M-n} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-move-line-down})

Move the current commit (or command) down.

@kindex r
@cindex git-rebase-reword
@item @kbd{r} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-reword})

Edit message of commit on current line.

@kindex e
@cindex git-rebase-edit
@item @kbd{e} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-edit})

Stop at the commit on the current line.

@kindex s
@cindex git-rebase-squash
@item @kbd{s} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-squash})

Meld commit on current line into previous commit, and edit message.

@kindex f
@cindex git-rebase-fixup
@item @kbd{f} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-fixup})

Meld commit on current line into previous commit, discarding the
current commit's message.

@kindex k
@cindex git-rebase-kill-line
@item @kbd{k} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-kill-line})

Kill the current action line.

@kindex c
@cindex git-rebase-pick
@item @kbd{c} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-pick})

Use commit on current line.

@kindex x
@cindex git-rebase-exec
@item @kbd{x} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-exec})

Insert a shell command to be run after the proceeding commit.

If there already is such a command on the current line, then edit
that instead.  With a prefix argument insert a new command even when
there already is one on the current line.  With empty input remove
the command on the current line, if any.

@kindex y
@cindex git-rebase-insert
@item @kbd{y} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-insert})

Read an arbitrary commit and insert it below current line.

@kindex C-x u
@cindex git-rebase-undo
@item @kbd{C-x u} @tie{}@tie{}@tie{}@tie{}(@code{git-rebase-undo})

Undo some previous changes.  Like @code{undo} but works in read-only
buffers.

@end table

@defopt git-rebase-auto-advance

Whether to move to next line after changing a line.
@end defopt

@defopt git-rebase-show-instructions

Whether to show usage instructions inside the rebase buffer.
@end defopt

@defopt git-rebase-confirm-cancel

Whether confirmation is required to cancel.
@end defopt

@node Cherry picking
@section Cherry picking

Also see 
@ifinfo
@ref{git-cherry-pick,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-cherry-pick">git-cherry-pick(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-cherry-pick(1) manpage
@end iftex
.

@table @asis
@kindex A
@cindex magit-cherry-pick-popup
@item @kbd{A} @tie{}@tie{}@tie{}@tie{}(@code{magit-cherry-pick-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
@end table

When no cherry-pick or revert is in progress, then the popup buffer
features the following commands.

@table @asis
@kindex A A
@cindex magit-cherry-pick
@item @kbd{A A} @tie{}@tie{}@tie{}@tie{}(@code{magit-cherry-pick})

Cherry-pick a commit.  Prompt for a commit, defaulting to the commit
at point.  If the region selects multiple commits, then pick all of
them, without prompting.

@kindex A a
@cindex magit-cherry-apply
@item @kbd{A a} @tie{}@tie{}@tie{}@tie{}(@code{magit-cherry-apply})

Apply the changes in a commit to the working tree, but do not commit
them.  Prompt for a commit, defaulting to the commit at point.  If
the region selects multiple commits, then apply all of them, without
prompting.

This command also has a top-level binding, which can be invoked without
using the popup by typing @code{a} at the top-level.
@end table

When a cherry-pick or revert is in progress, then the popup buffer
features these commands instead.

@table @asis
@kindex A A
@cindex magit-sequence-continue
@item @kbd{A A} @tie{}@tie{}@tie{}@tie{}(@code{magit-sequence-continue})

Resume the current cherry-pick or revert sequence.

@kindex A s
@cindex magit-sequence-skip
@item @kbd{A s} @tie{}@tie{}@tie{}@tie{}(@code{magit-sequence-skip})

Skip the stopped at commit during a cherry-pick or revert sequence.

@kindex A a
@cindex magit-sequence-abort
@item @kbd{A a} @tie{}@tie{}@tie{}@tie{}(@code{magit-sequence-abort})

Abort the current cherry-pick or revert sequence.  This discards all
changes made since the sequence started.
@end table

@menu
* Reverting::
@end menu

@node Reverting
@subsection Reverting

@table @asis
@kindex V
@cindex magit-revert-popup
@item @kbd{V} @tie{}@tie{}@tie{}@tie{}(@code{magit-revert-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
@end table

When no cherry-pick or revert is in progress, then the popup buffer
features the following commands.

@table @asis
@kindex V V
@cindex magit-revert
@item @kbd{V V} @tie{}@tie{}@tie{}@tie{}(@code{magit-revert})

Revert a commit by creating a new commit.  Prompt for a commit,
defaulting to the commit at point.  If the region selects multiple
commits, then revert all of them, without prompting.

@kindex V v
@cindex magit-revert-no-commit
@item @kbd{V v} @tie{}@tie{}@tie{}@tie{}(@code{magit-revert-no-commit})

Revert a commit by applying it in reverse to the working tree.
Prompt for a commit, defaulting to the commit at point.  If the
region selects multiple commits, then revert all of them, without
prompting.
@end table

When a cherry-pick or revert is in progress, then the popup buffer
features these commands instead.

@table @asis
@kindex V A
@cindex magit-sequence-continue
@item @kbd{V A} @tie{}@tie{}@tie{}@tie{}(@code{magit-sequence-continue})

Resume the current cherry-pick or revert sequence.

@kindex V s
@cindex magit-sequence-skip
@item @kbd{V s} @tie{}@tie{}@tie{}@tie{}(@code{magit-sequence-skip})

Skip the stopped at commit during a cherry-pick or revert sequence.

@kindex V a
@cindex magit-sequence-abort
@item @kbd{V a} @tie{}@tie{}@tie{}@tie{}(@code{magit-sequence-abort})

Abort the current cherry-pick or revert sequence.  This discards all
changes made since the sequence started.
@end table

@node Resetting
@section Resetting

Also see 
@ifinfo
@ref{git-reset,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-reset">git-reset(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-reset(1) manpage
@end iftex
.

@table @asis
@kindex x
@cindex magit-reset
@item @kbd{x} @tie{}@tie{}@tie{}@tie{}(@code{magit-reset})

Reset the head and index to some commit read from the user and
defaulting to the commit at point.  The working tree is kept as-is.
With a prefix argument also reset the working tree.

@kindex U
@cindex magit-reset-index
@item @kbd{U} @tie{}@tie{}@tie{}@tie{}(@code{magit-reset-index})

Reset the index to some commit read from the user and defaulting to
the commit at point.  Keep the @code{HEAD} and working tree as-is, so if
the commit refers to the @code{HEAD}, then this effectively unstages all
changes.

@kindex M-x magit-reset-head
@cindex magit-reset-head
@item @kbd{M-x magit-reset-head} @tie{}@tie{}@tie{}@tie{}(@code{magit-reset-head})

Reset the @code{HEAD} and index to some commit read from the user and
defaulting to the commit at point.  The working tree is kept as-is.

@kindex M-x magit-reset-soft
@cindex magit-reset-soft
@item @kbd{M-x magit-reset-soft} @tie{}@tie{}@tie{}@tie{}(@code{magit-reset-soft})

Reset the @code{HEAD} to some commit read from the user and defaulting
to the commit at point.  The index and the working tree are kept
as-is.

@kindex M-x magit-reset-hard
@cindex magit-reset-hard
@item @kbd{M-x magit-reset-hard} @tie{}@tie{}@tie{}@tie{}(@code{magit-reset-hard})

Reset the @code{HEAD}, index, and working tree to some commit read from the
user and defaulting to the commit at point.
@end table

@node Stashing
@section Stashing

Also see 
@ifinfo
@ref{git-stash,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-stash">git-stash(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-stash(1) manpage
@end iftex
.

@table @asis
@kindex z
@cindex magit-stash-popup
@item @kbd{z} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex z z
@cindex magit-stash
@item @kbd{z z} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash})

Create a stash of the index and working tree.  Untracked files are
included according to popup arguments.  One prefix argument is
equivalent to @code{--include-untracked} while two prefix arguments are
equivalent to @code{--all}.

@kindex z i
@cindex magit-stash-index
@item @kbd{z i} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-index})

Create a stash of the index only.  Unstaged and untracked changes
are not stashed.

@kindex z w
@cindex magit-stash-worktree
@item @kbd{z w} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-worktree})

Create a stash of the working tree only.  Untracked files are
included according to popup arguments.  One prefix argument is
equivalent to @code{--include-untracked} while two prefix arguments are
equivalent to @code{--all}.

@kindex z x
@cindex magit-stash-keep-index
@item @kbd{z x} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-keep-index})

Create a stash of the index and working tree, keeping index intact.
Untracked files are included according to popup arguments.  One
prefix argument is equivalent to @code{--include-untracked} while two
prefix arguments are equivalent to @code{--all}.

@kindex z Z
@cindex magit-snapshot
@item @kbd{z Z} @tie{}@tie{}@tie{}@tie{}(@code{magit-snapshot})

Create a snapshot of the index and working tree.  Untracked files
are included according to popup arguments.  One prefix argument is
equivalent to @code{--include-untracked} while two prefix arguments are
equivalent to @code{--all}.

@kindex z I
@cindex magit-snapshot-index
@item @kbd{z I} @tie{}@tie{}@tie{}@tie{}(@code{magit-snapshot-index})

Create a snapshot of the index only.  Unstaged and untracked changes
are not stashed.

@kindex z W
@cindex magit-snapshot-worktree
@item @kbd{z W} @tie{}@tie{}@tie{}@tie{}(@code{magit-snapshot-worktree})

Create a snapshot of the working tree only.  Untracked files are
included according to popup arguments.  One prefix argument is
equivalent to @code{--include-untracked} while two prefix arguments are
equivalent to @code{--all}-.

@kindex z a
@cindex magit-stash-apply
@item @kbd{z a} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-apply})

Apply a stash to the working tree.  Try to preserve the stash index.
If that fails because there are staged changes, apply without
preserving the stash index.

@kindex z p
@cindex magit-stash-pop
@item @kbd{z p} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-pop})

Apply a stash to the working tree and remove it from stash list.
Try to preserve the stash index.  If that fails because there are
staged changes, apply without preserving the stash index and forgo
removing the stash.

@kindex z d
@cindex magit-stash-drop
@item @kbd{z d} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-drop})

Remove a stash from the stash list.  When the region is active, offer
to drop all contained stashes.

@kindex z l
@cindex magit-stash-list
@item @kbd{z l} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-list})

List all stashes in a buffer.

@kindex z v
@cindex magit-stash-show
@item @kbd{z v} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-show})

Show all diffs of a stash in a buffer.

@kindex z b
@cindex magit-stash-branch
@item @kbd{z b} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-branch})

Create and checkout a new BRANCH from STASH.

@kindex k
@cindex magit-stash-clear
@item @kbd{k} @tie{}@tie{}@tie{}@tie{}(@code{magit-stash-clear})

Remove all stashes saved in REF's reflog by deleting REF.
@end table

@node Transferring
@chapter Transferring


@menu
* Remotes::
* Fetching::
* Pulling::
* Pushing::
* Creating and sending patches::
* Applying patches::
@end menu

@node Remotes
@section Remotes

Also see 
@ifinfo
@ref{git-remote,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-remote">git-remote(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-remote(1) manpage
@end iftex
.

@table @asis
@kindex M
@cindex magit-remote-popup
@item @kbd{M} @tie{}@tie{}@tie{}@tie{}(@code{magit-remote-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex M a
@cindex magit-remote-add
@item @kbd{M a} @tie{}@tie{}@tie{}@tie{}(@code{magit-remote-add})

Add a remote and fetch it.  The remote name and url are read in the
minibuffer.

@kindex M r
@cindex magit-remote-rename
@item @kbd{M r} @tie{}@tie{}@tie{}@tie{}(@code{magit-remote-rename})

Rename a remote.  Both the old and the new names are read in the
minibuffer.

@kindex M u
@cindex magit-remote-set-url
@item @kbd{M u} @tie{}@tie{}@tie{}@tie{}(@code{magit-remote-set-url})

Change the url of a remote.  Both the remote and the new url are
read in the minibuffer.

@kindex M k
@cindex magit-remote-remove
@item @kbd{M k} @tie{}@tie{}@tie{}@tie{}(@code{magit-remote-remove})

Delete a remote, read from the minibuffer.
@end table

@node Fetching
@section Fetching

Also see 
@ifinfo
@ref{git-fetch,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-fetch">git-fetch(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-fetch(1) manpage
@end iftex
.

@table @asis
@kindex f
@cindex magit-fetch-popup
@item @kbd{f} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex f f
@cindex magit-fetch-current
@item @kbd{f f} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-current})

Fetch from the upstream repository of the current branch.  If @code{HEAD}
is detached or if the upstream is not configured, then read the
remote.

@kindex f o
@cindex magit-fetch
@item @kbd{f o} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch})

Fetch from another repository.

@kindex f a
@cindex magit-fetch-all
@item @kbd{f a} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-all})

Fetch from all configured remotes.

@kindex f m
@cindex magit-submodule-fetch
@item @kbd{f m} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-fetch})

Fetch all submodules.  With a prefix argument fetch all remotes or
all submodules.
@end table

@node Pulling
@section Pulling

Also see 
@ifinfo
@ref{git-pull,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-pull">git-pull(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-pull(1) manpage
@end iftex
.

@table @asis
@kindex F
@cindex magit-pull-popup
@item @kbd{F} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex F F
@cindex magit-pull-current
@item @kbd{F F} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull-current})

Fetch and merge into current branch.

@kindex F o
@cindex magit-pull
@item @kbd{F o} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull})

Fetch from another repository and merge a fetched branch.
@end table

@node Pushing
@section Pushing

Also see 
@ifinfo
@ref{git-push,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-push">git-push(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-push(1) manpage
@end iftex
.

@table @asis
@kindex P
@cindex magit-push-popup
@item @kbd{P} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex P P
@cindex magit-push-current
@item @kbd{P P} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-current})

Push the current branch to its upstream branch.  If the upstream
isn't set, then read the remote branch.

@kindex P o
@cindex magit-push
@item @kbd{P o} @tie{}@tie{}@tie{}@tie{}(@code{magit-push})

Push a branch to its upstream branch.  If the upstream isn't set,
then read the remote branch.

@kindex P e
@cindex magit-push-elsewhere
@item @kbd{P e} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-elsewhere})

Push a branch or commit to some remote branch.  Read the local and
remote branch.

@kindex P m
@cindex magit-push-matching
@item @kbd{P m} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-matching})

Push all matching branches to another repository.  If multiple
remotes exit, then read one from the user.  If just one exists, use
that without requiring confirmation.

@kindex P t
@cindex magit-push-tags
@item @kbd{P t} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-tags})

Push all tags to another repository.  If only one remote exists,
then push to that.  Otherwise prompt for a remote, offering the
remote configured for the current branch as default.

@kindex P T
@cindex magit-push-tag
@item @kbd{P T} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-tag})

Push a tag to another repository.
@end table

@node Creating and sending patches
@section Creating and sending patches

@table @asis
@kindex W
@cindex magit-patch-popup
@item @kbd{W} @tie{}@tie{}@tie{}@tie{}(@code{magit-patch-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex W p
@cindex magit-format-patch
@item @kbd{W p} @tie{}@tie{}@tie{}@tie{}(@code{magit-format-patch})

Create patches for a set commits.  If the region marks commits, then
create patches for those.  Otherwise prompt for a range or a single
commit, defaulting to the commit at point.

@kindex W r
@cindex magit-request-pull
@item @kbd{W r} @tie{}@tie{}@tie{}@tie{}(@code{magit-request-pull})

Request that upstream pulls from your public repository.
@end table

@node Applying patches
@section Applying patches

Also see 
@ifinfo
@ref{git-am,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-am">git-am(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-am(1) manpage
@end iftex
.

@table @asis
@kindex w
@cindex magit-am-popup
@item @kbd{w} @tie{}@tie{}@tie{}@tie{}(@code{magit-am-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex w w
@cindex magit-am-apply-patches
@item @kbd{w w} @tie{}@tie{}@tie{}@tie{}(@code{magit-am-apply-patches})

Apply one or more patches.  If the region marks files, then apply
those patches.  Otherwise read a file name in the minibuffer
defaulting to the file at point.

@kindex w m
@cindex magit-am-apply-maildir
@item @kbd{w m} @tie{}@tie{}@tie{}@tie{}(@code{magit-am-apply-maildir})

Apply the patches from a maildir.

@kindex w w
@cindex magit-am-continue
@item @kbd{w w} @tie{}@tie{}@tie{}@tie{}(@code{magit-am-continue})

Resume the current patch applying sequence.

@kindex w s
@cindex magit-am-skip
@item @kbd{w s} @tie{}@tie{}@tie{}@tie{}(@code{magit-am-skip})

Skip the stopped at patch during a patch applying sequence.

@kindex w a
@cindex magit-am-abort
@item @kbd{w a} @tie{}@tie{}@tie{}@tie{}(@code{magit-am-abort})

Abort the current patch applying sequence.  This discards all
changes made since the sequence started.
@end table

@node Miscellaneous
@chapter Miscellaneous


@menu
* Tagging::
* Notes::
* Submodules::
* Wip Modes::
@end menu

@node Tagging
@section Tagging

Also see 
@ifinfo
@ref{git-tag,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-tag">git-tag(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-tag(1) manpage
@end iftex
.

@table @asis
@kindex t
@cindex magit-tag-popup
@item @kbd{t} @tie{}@tie{}@tie{}@tie{}(@code{magit-tag-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex t t
@cindex magit-tag
@item @kbd{t t} @tie{}@tie{}@tie{}@tie{}(@code{magit-tag})

Create a new tag with the given NAME at REV.  With a prefix argument
annotate the tag.

@kindex t k
@cindex magit-tag-delete
@item @kbd{t k} @tie{}@tie{}@tie{}@tie{}(@code{magit-tag-delete})

Delete one or more tags.  If the region marks multiple tags (and
nothing else), then offer to delete those.  Otherwise, prompt for a
single tag to be deleted, defaulting to the tag at point.

@kindex t p
@cindex magit-tag-prune
@item @kbd{t p} @tie{}@tie{}@tie{}@tie{}(@code{magit-tag-prune})

Offer to delete tags missing locally from REMOTE, and vice versa.
@end table

@node Notes
@section Notes

Also see 
@ifinfo
@ref{git-notes,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-notes">git-notes(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-notes(1) manpage
@end iftex
.

@table @asis
@kindex T
@cindex magit-notes-popup
@item @kbd{T} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex T T
@cindex magit-notes-edit
@item @kbd{T T} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-edit})

Edit the note attached to a commit, defaulting to the commit at
point.

By default use the value of Git variable @code{core.notesRef} or
"refs/notes/commits" if that is undefined.

@kindex T r
@cindex magit-notes-remove
@item @kbd{T r} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-remove})

Remove the note attached to a commit, defaulting to the commit at
point.

By default use the value of Git variable @code{core.notesRef} or
"refs/notes/commits" if that is undefined.

@kindex T p
@cindex magit-notes-prune
@item @kbd{T p} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-prune})

Remove notes about unreachable commits.

@kindex T s
@cindex magit-notes-set-ref
@item @kbd{T s} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-set-ref})

Set the current notes ref to a the value read from the user.  The
ref is made current by setting the value of the Git variable
@code{core.notesRef}.  With a prefix argument change the global value
instead of the value in the current repository.  When this is
undefined, then "refs/notes/commit" is used.

Other @code{magit-notes-*} commands, as well as the sub-commands of Git's
@code{note} command, default to operate on that ref.

@kindex T S
@cindex magit-notes-set-display-refs
@item @kbd{T S} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-set-display-refs})

Set notes refs to be display in addition to "core.notesRef".  This
reads a colon separated list of notes refs from the user.  The
values are stored in the Git variable @code{notes.displayRef}.  With a
prefix argument GLOBAL change the global values instead of the
values in the current repository.
@end table

It is possible to merge one note ref into another.  That may result in
conflicts which have to resolved in the temporary worktree
".git/NOTES@math{_MERGE}@math{_WORKTREE}".

@table @asis
@kindex T m
@cindex magit-notes-merge
@item @kbd{T m} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-merge})

Merge the notes of a ref read from the user into the current notes
ref.  The current notes ref is the value of Git variable
@code{core.notesRef} or "refs/notes/commits" if that is undefined.
@end table

When a notes merge is in progress then the popup features the
following suffix commands, instead of those listed above.

@table @asis
@kindex T c
@cindex magit-notes-merge-commit
@item @kbd{T c} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-merge-commit})

Commit the current notes ref merge, after manually resolving
conflicts.

@kindex T a
@cindex magit-notes-merge-abort
@item @kbd{T a} @tie{}@tie{}@tie{}@tie{}(@code{magit-notes-merge-abort})

Abort the current notes ref merge.
@end table

@node Submodules
@section Submodules

Also see 
@ifinfo
@ref{git-submodule,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-submodule">git-submodule(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-submodule(1) manpage
@end iftex
.

@table @asis
@kindex o
@cindex magit-submodule-popup
@item @kbd{o} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-popup})

This prefix commands shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.

@kindex o a
@cindex magit-submodule-add
@item @kbd{o a} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-add})

Add the repository at URL as a submodule.  Optional PATH is the path
to the submodule relative to the root of the super-project. If it is
nil then the path is determined based on URL.

@kindex o b
@cindex magit-submodule-setup
@item @kbd{o b} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-setup})

Clone and register missing submodules and checkout appropriate
commits.

@kindex o i
@cindex magit-submodule-init
@item @kbd{o i} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-init})

Register submodules listed in ".gitmodules" into ".git/config".

@kindex o u
@cindex magit-submodule-update
@item @kbd{o u} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-update})

Clone missing submodules and checkout appropriate commits.  With a
prefix argument also register submodules in ".git/config".

@kindex o s
@cindex magit-submodule-sync
@item @kbd{o s} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-sync})

Update each submodule's remote URL according to ".gitmodules".

@kindex o f
@cindex magit-submodule-fetch
@item @kbd{o f} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-fetch})

Fetch submodule.  With a prefix argument fetch all remotes.
@end table

@node Wip Modes
@section Wip Modes

Git keeps @strong{committed} changes around long enough for users to recover
changes they have accidentally deleted.  It does so by not garbage
collecting any committed but no longer referenced objects for a
certain period of time, by default 30 days.

But Git does @strong{not} keep track of @strong{uncommitted} changes in the working tree
and not even the index (the staging area).  Because Magit makes it so
convenient to modify uncommitted changes, it also makes it easy to
shoot yourself in the foot in the process.

For that reason Magit provides three global modes that save @strong{tracked}
files to work-in-progress references after or before certain actions.
(Untracked files are never saved and these modes also only work after
the first commit has been created).

Two separate work-in-progress references are used to track the state
of the index and of the working tree: "refs/wip/index/<branchref>" and
"refs/wip/wtree/<branchref>", where @code{<branchref>} is the full ref of the
current branch, e.g. "refs/heads/master".  When the @code{HEAD} is detached
then "HEAD" is in place of @code{<branchref>}.

Checking out another branch (or detaching @code{HEAD}) causes the use of
different wip refs for subsequent changes, but the old refs are not
deleted.

Creating a commit and then making a change causes the wip refs to be
recreated to fork from the new commit.  But the old commits on the wip
refs are not lost.  They are still available from the reflog.  To make
it easier to see when the fork point of a wip ref was changed, an
additional commit with the message "restart autosaving" is created on
it (@code{xxO} commits below are such boundary commits).

Starting with

@verbatim
      BI0---BI1    refs/wip/index/refs/heads/master
     /
A---B              refs/heads/master
     \
      BW0---BW1    refs/wip/wtree/refs/heads/master
@end verbatim

and committing the staged changes and editing and saving a file would
result in

@verbatim
      BI0---BI1        refs/wip/index/refs/heads/master
     /
A---B---C              refs/heads/master
     \   \
      \   CW0---CW1    refs/wip/wtree/refs/heads/master
       \
        BW0---BW1      refs/wip/wtree/refs/heads/master@{2}
@end verbatim

The fork-point of the index wip ref is not changed until some change
is being staged.  Likewise just checking out a branch or creating a
commit does not change the fork-point of the working tree wip ref.  The
fork-points are not adjusted until there actually is a change that
should be committed to the respective wip ref.

To recover a lost change from a wip ref, use the reflog.  To show the
reflog, use e.g. @code{lO refs/wip/index/refs/heads/master RET} and then move
around until you find the commit which has the lost change.  You might
then be able to simply apply it using @code{a} (@code{magit-apply}).

There exists a total of three global modes that save to the wip refs,
which might seem excessive, but allows fine tuning of when exactly
changes are being committed to the wip refs.  Enabling all modes makes
it less likely that a change slips through the cracks.

@defopt magit-wip-after-save-mode

When this mode is enabled, then saving a buffer that visits a file
tracked in a Git repository causes its current state to be committed
to the working tree wip ref for the current branch.
@end defopt

@defopt magit-wip-after-apply-mode

When this mode is enabled, then applying (i.e. staging, unstaging,
discarding, reversing, and regularly applying) a change to a file
tracked in a Git repository causes its current state to be committed
to the index and/or working tree wip refs for the current branch.
@end defopt

If you only ever edit files using Emacs and only ever interact with
Git using Magit, then the above two modes should be enough to protect
each and every change from accidental loss.  In practice nobody does
that.  So an additional mode exists that does commit to the wip refs
before making changes that could cause the loss of earlier changes.

@defopt magit-wip-before-change-mode

When this mode is enabled, then certain commands commit the existing
changes to the files they are about to make changes to.
@end defopt

Note that even if you enable all three modes this won't give you
perfect protection.  The most likely scenario for losing changes
despite the use of these modes is making a change outside Emacs and
then destroying it also outside Emacs.  In such a scenario, Magit,
being an Emacs package, didn't get the opportunity to keep you from
shooting yourself in the foot.

When you are unsure whether Magit did commit a change to the wip refs,
then you can explicitly request that all changes to all tracked files
are being committed.

@table @asis
@kindex M-x magit-wip-commit
@cindex magit-wip-commit
@item @kbd{M-x magit-wip-commit} @tie{}@tie{}@tie{}@tie{}(@code{magit-wip-commit})

This command commits all changes to all tracked files to the index
and working tree work-in-progress refs.  Like the modes described above,
it does not commit untracked files, but it does check all tracked
files for changes.  Use this command when you suspect that the modes
might have overlooked a change made outside Emacs/Magit.

@end table

@defopt magit-wip-after-save-local-mode-lighter

Mode-line lighter for @code{magit-wip-after-save-local-mode}.
@end defopt

@defopt magit-wip-after-apply-mode-lighter

Mode-line lighter for @code{magit-wip-after-apply-mode}.
@end defopt

@defopt magit-wip-before-change-mode-lighter

Mode-line lighter for @code{magit-wip-before-change-mode}.
@end defopt

@defopt magit-wip-namespace

The namespace used for work-in-progress refs.  It has to end with a
slash.  The wip refs are named "<namespace>index/<branchref>" and
"<namespace>wtree/<branchref>".  When snapshots are created while
the @code{HEAD} is detached then "HEAD" is used in place of @code{<branchref>}.
@end defopt

@node Customizing
@chapter Customizing

Both Git and Emacs are highly customizable.  Magit is both a Git
porcelain as well as an Emacs package, so it makes sense to customize
it using both Git variables as well as Emacs options.  However this
flexibility doesn't come without problems, including but not limited
to the following.

@itemize
@item
Some Git variables automatically have an effect in Magit without
requiring any explicit support.  Sometimes that is desirable - in
other cases, it breaks Magit.

When a certain Git setting breaks Magit but you want to keep using
that setting on the command line, then that can be accomplished by
overriding the value for Magit only by appending something like
@code{("-c" "some.variable=compatible-value")} to
@code{magit-git-global-arguments}.


@item
Certain settings like @code{fetch.prune=true} are respected by Magit
commands (because they simply call the respective Git command) but
their value is not reflected in the respective popup buffers.  In
this case the @code{--prune} argument in @code{magit-fetch-popup} might be active
or inactive depending on the value of @code{magit-fetch-arguments} only,
but that doesn't keep the Git variable from being honored by the
suffix commands anyway.  So pruning might happen despite the the
@code{--prune} arguments being displayed in a way that seems to indicate
that no pruning will happen.
@end itemize

I intend to address these and similar issues in a future release.

@menu
* Per-repository configuration::
* Essential settings::
@end menu

@node Per-repository configuration
@section Per-repository configuration

Magit can be configured on a per-repository level using both Git
variables as well as Emacs options.

To set a Git variable for one repository only, simply set it in
@code{/path/to/repo/.git/config} instead of @code{$HOME/.gitconfig} or
@code{/etc/gitconfig}.  See 
@ifinfo
@ref{git-config,,,gitman,}
@end ifinfo
@ifhtml
@html
the <a href="http://git-scm.com/docs/git-config">git-config(1)</a> manpage
@end html
@end ifhtml
@iftex
the git-config(1) manpage
@end iftex
.

Similarly, Emacs options can be set for one repository only by editing
@code{/path/to/repo/.dir-locals.el}.  See @ref{Directory Variables,,,emacs,}.
For example to disable automatic refreshes of file-visiting buffers in
just one huge repository use this:

@itemize
@item
@code{/path/to/huge/repo/.dir-locals.el}

@lisp
((nil . ((magit-refresh-buffers . nil))
@end lisp
@end itemize

If you want to apply the same settings to several, but not all,
repositories then keeping the repository-local config files in sync
would quickly become annoying.  To avoid that you can create config
files for certain classes of repositories (e.g. "huge repositories")
and then include those files in the per-repository config files.
For example:

@itemize
@item
@code{/path/to/huge/repo/.git/config}

@example
[include]
        path = /path/to/huge-gitconfig
@end example


@item
@code{/path/to/huge-gitconfig}

@example
[status]
        showUntrackedFiles = no
@end example


@item
@code{$HOME/.emacs.d/init.el}

@lisp
(dir-locals-set-class-variables 'huge-git-repository
   '((nil . ((magit-refresh-buffers . nil)))))

(dir-locals-set-directory-class
   "/path/to/huge/repo/" 'huge-git-repository)
@end lisp
@end itemize

@node Essential settings
@section Essential settings

The next two sections list and discuss several variables that many
users might want to customize, for safety and/or performance reasons.

@menu
* Safety::
* Performance::
@end menu

@node Safety
@subsection Safety

This section discusses various variables that you might want to
change (or @strong{not} change) for safety reasons.

Git keeps @strong{committed} changes around long enough for users to recover
changes they have accidentally deleted.  It does not do the same for
@strong{uncommitted} changes in the working tree and not even the index (the
staging area).  Because Magit makes it so easy to modify uncommitted
changes, it also makes it easy to shoot yourself in the foot in the
process.  For that reason Magit provides three global modes that save
@strong{tracked} files to work-in-progress references after or before certain
actions.  See @ref{Wip Modes,Wip Modes}.

These modes are not enabled by default because of performance
concerns.  Instead a lot of potentially destructive commands require
confirmation every time they are used.  In many cases this can be
disabled by adding a symbol to @code{magit-no-confirm} (see @ref{Completion and confirmation,Completion and confirmation}).  If you enable the various wip modes then you should
add @code{safe-with-wip} to this list.

Similarly it isn't necessary to require confirmation before moving a
file to the system trash - if you trashed a file by mistake then you
can recover it from the there.  Option @code{magit-delete-by-moving-to-trash}
controls whether the system trash is used, which is the case by default.
Nevertheless, @code{trash} isn't a member of @code{magit-no-confirm} - you
might want to change that.

Buffers visiting files tracked in the current repository are being
refreshed before certain actions.  See @ref{Automatic refresh and revert,Automatic refresh and revert}.
This isn't as risky as it might seem.  If a buffer is modified
(i.e. it contains changes that haven't been saved yet), then
Emacs/Magit would refuse to revert it.  If the buffer has been saved
resulting in what is seen by Git as an uncommitted change, then Git in
turn would refuse to carry out the action that would cause these
changes to be lost.  Since Git doesn't do anything, the file doesn't
change on disk, and Emacs/Magit has nothing to revert.

However if you do modify some files, visit the respective files in
Emacs, somehow discard the changes (not using Magit and probably even
outside Emacs), and then expect the respective file-visiting buffers
to retain the uncommitted changes, then the automatic reverting would
actually be harmful.  In other words if you use file-visiting buffers
as a sort of "staging area", then you should set @code{magit-revert-buffers}
to @code{nil}.

So far I have only heard from one user who uses such a workflow.  But
because there might be some other users doing such things, and I don't
want to be responsible for data loss, these reverts by default happen
quite verbosely, allowing these few users to undo the reverts using
the @code{undo} command and then disabling the automatic reverts for the
future.  Most users should however keep automatic reverts turned on
and instead configure it to be less verbose by setting
@code{magit-revert-buffers} to @code{t} or even @code{silent}.

@node Performance
@subsection Performance

Magit is slower than raw Git because it does more.  For example @code{git
commit} creates a commit and that's it.  @code{magit-commit} also updates the
current Magit buffer to make sure you are not looking at outdated
information without noticing it.  To refresh the status buffer, Magit
has to run Git a dozen times or more, making it slower than @code{git
status}, but also much more informative.  Magit also optionally reverts
file-visiting buffers, creates backups, runs hooks where third-party
extensions can do their slow thing, etc.

I do care about performance and try to optimize for it as much as
possible, but many features simply come with an inherent performance
penalty.  When a feature is just too slow given certain usage and
repository characteristics, then it often can be disabled, globally or
on a per-repository basis.

But first a short list of performance issues that cannot easily be
worked around:

@itemize
@item
Creating a new process on MS Windows is much slower than on
POSIX-compatible systems.  This is a problem because Magit creates a
lot of child processes to retrieve information from Git.  In the
short run, only switching to a POSIX system can fix this.  Of course
this could also be fixed in Windows itself, but I am just one unpaid
person while Microsoft is a billion dollar company, so I will leave
it to them to fix this grave flaw in their OS.


@item
When showing logs, Magit limits the number of commits initially
shown in the hope that this avoids unnecessary work.  When using
@code{--graph} this unfortunately does not have the desired effect for
large histories.  Junio said on the git mailing list
(@uref{http://www.spinics.net/lists/git/msg232230.html}): "@code{--graph} wants to
compute the whole history and the max-count only affects the output
phase after @code{--graph} does its computation".

In other words, it's not that Git is slow at outputting the
differences, or that Magit is slow at parsing the output - the
problem is that Git first goes outside and has a smoke.  This has to
be fixed in Git but so far nobody volunteered to do it.  Maybe you
could do that?


@item
Whenever "something changes", Magit "refreshes" the status buffer and
the current Magit buffer by recreating them from scratch.  This is
an old design decision that we couldn't depart from easily.  And it
has its benefits too - most importantly it's much simpler and less
error prone to do it this way than to only refreshing "what actually
has changed" (that would basically be a huge collection of special
cases).  So for now at least, we don't avoid recreating the buffer
content and instead focus on making doing so faster.
@end itemize

Now for the things that you can do to improve performance:

Most optional features which can have a negative effect on performance
are disabled by default.  So start by checking the options you have
customized.  Even the potentially slow features are expected to only
lead to barely noticeable delays, but your mileage may vary.  Also
note that it is now possible to set options on a per-repository or
per-repository-class basis.  See @ref{Per-repository configuration,Per-repository configuration}.

You should check the values of at least the following variables:

@itemize
@item
@code{magit-after-revert-hook}

@item
@code{magit-diff-auto-show}

@item
@code{magit-diff-highlight-hunk-body}

@item
@code{magit-diff-highlight-indentation}

@item
@code{magit-diff-highlight-whitespace}

@item
@code{magit-diff-paint-whitespace}

@item
@code{magit-diff-refine-hunk}

@item
@code{magit-not-reverted-hook}

@item
@code{magit-refresh-buffer-hook}

@item
@code{magit-status-refresh-hook}

@item
@code{magit-wip-after-apply-mode}

@item
@code{magit-wip-after-save-mode}

@item
@code{magit-wip-before-change-mode}
@end itemize

Also note that everything involving "cherry commits" is slow.

If nothing helps, then feel free to open a new issue.  Please provide
benchmarks.

@node Plumbing
@chapter Plumbing

The following sections describe how to use several of Magit's core
abstractions to extend Magit itself or implement a separate extension.

A few of the low-level features used by Magit have been factored out
into separate libraries/packages, so that they can be used by other
packages, without having to depend on Magit.  These libraries are
described in separate manuals, see @ref{Top,,,with-editor,} and
@ref{Top,,,magit-popup,}.

@menu
* Calling Git::
* Section plumbing::
* Refreshing buffers::
* Conventions::
@end menu

@node Calling Git
@section Calling Git

Magit provides many specialized functions for calling Git.  All of
these functions are defined in either @code{magit-git.el} or @code{magit-process.el}
and have one of the prefixes @code{magit-run-}, @code{magit-call-}, @code{magit-start-},
or @code{magit-git-} (which is also used for other things).

All of these functions accept an indefinite number of arguments, which
are strings that specify command line arguments for git (or in some
cases an arbitrary executable).  These arguments are flattened before
being passed on to the executable; so instead of strings they can also
be lists of strings and arguments that are @code{nil} are silently dropped.
Some of these functions also require a single mandatory argument
before these command line arguments.

Roughly speaking these functions run Git either to get some value or
for side-effect.  The functions that return a value are useful to
collect the information necessary to populate a Magit buffer, while
the others are used to implement Magit commands.

The functions in the value-only group always run synchronously, and
they never trigger a refresh.  The function in the side-effect group
can be further divided into subgroups depending on whether they run
Git synchronously or asynchronously, and depending on whether they
trigger a refresh when the executable has finished.

@menu
* Getting a value from Git::
* Calling Git for effect::
@end menu

@node Getting a value from Git
@subsection Getting a value from Git

These functions run Git in order to get a value, either its exit
status or its output.  Of course you could also use them to run Git
commands that have side-effects, but that should be avoided.

@defun magit-git-exit-code &rest args

Executes git with ARGS and returns its exit code.
@end defun

@defun magit-git-success &rest args

Executes git with ARGS and returns @code{t} if the exit code is @code{0}, @code{nil}
otherwise.
@end defun

@defun magit-git-failure &rest args

Executes git with ARGS and returns @code{t} if the exit code is @code{1}, @code{nil}
otherwise.
@end defun

@defun magit-git-true &rest args

Executes git with ARGS and returns @code{t} if the first line printed by
git is the string "true", @code{nil} otherwise.
@end defun

@defun magit-git-false &rest args

Executes git with ARGS and returns @code{t} if the first line printed by
git is the string "false", @code{nil} otherwise.
@end defun

@defun magit-git-insert &rest args

Executes git with ARGS and inserts its output at point.
@end defun

@defun magit-git-string &rest args

Executes git with ARGS and returns the first line of its output.  If
there is no output or if it begins with a newline character, then
this returns @code{nil}.
@end defun

@defun magit-git-lines &rest args

Executes git with ARGS and returns its output as a list of lines.
Empty lines anywhere in the output are omitted.
@end defun

@defun magit-git-items &rest args

Executes git with ARGS and returns its null-separated output as a
list.  Empty items anywhere in the output are omitted.

If the value of option @code{magit-git-debug} is non-nil and git exits with
a non-zero exit status, then warn about that in the echo area and
add a section containing git's standard error in the current
repository's process buffer.
@end defun

When an error occurs when using one of the above functions, then that
is usually due to a bug, i.e. the use of an argument which is not
actually supported.  Such errors are usually not reported, but when
they occur we need to be able to debug them.

@defopt magit-git-debug

Whether to report errors that occur when using @code{magit-git-insert},
@code{magit-git-string}, @code{magit-git-lines}, or @code{magit-git-items}.  This does
not actually raise an error.  Instead a message is shown in the echo
area, and git's standard error is insert into a new section in the
current repository's process buffer.
@end defopt

@defun magit-git-str &rest args

This is a variant of @code{magit-git-string} that ignores the option
@code{magit-git-debug}.  It is mainly intended to be used while handling
errors in functions that do respect that option.  Using such a
function while handing an error could cause yet another error and
therefore lead to an infinite recursion.  You probably won't ever
need to use this function.
@end defun

@node Calling Git for effect
@subsection Calling Git for effect

These functions are used to run git to produce some effect.  Most
Magit commands that actually run git do so by using such a function.

Because we do not need to consume git's output when using these
functions, their output is instead logged into a per-repository
buffer, which can be shown using @code{$} from a Magit buffer or @code{M-x
magit-process} elsewhere.

These functions can have an effect in two distinct ways.  Firstly,
running git may change something, i.e. create or push a new commit.
Secondly, that change may require that Magit buffers are refreshed to
reflect the changed state of the repository.  But refreshing isn't
always desirable, so only some of these functions do perform such a
refresh after git has returned.

Sometimes it is useful to run git asynchronously.  For example, when
the user has just initiated a push, then there is no reason to make
her wait until that has completed.  In other cases it makes sense to
wait for git to complete before letting the user do something else.
For example after staging a change it is useful to wait until after
the refresh because that also automatically moves to the next change.

@defun magit-call-git &rest args

Calls git synchronously with ARGS.
@end defun

@defun magit-call-process program &rest args

Calls PROGRAM synchronously with ARGS.
@end defun

@defun magit-run-git &rest args

Calls git synchronously with ARGS and then refreshes.
@end defun

@defun magit-run-git-with-input input &rest args

Calls git synchronously with ARGS and sends it INPUT on standard
input.

INPUT should be a buffer or the name of an existing buffer.  The
content of that buffer is used as the process' standard input.
After the process returns a refresh is performed.

As a special case, INPUT may also be nil.  In that case the content
of the current buffer is used as standard input and @strong{no} refresh is
performed.

This function actually runs git asynchronously.  But then it waits
for the process to return, so the function itself is synchronous.
@end defun

@defun magit-run-git-with-logfile file &rest args

Calls git synchronously with ARGS.  The process' output is saved in
FILE.  This is rarely useful and so this function might be removed
in the future.

This function actually runs git asynchronously.  But then it waits
for the process to return, so the function itself is synchronous.
@end defun

@defun magit-git &rest args

Calls git synchronously with ARGS for side-effects only.  This
function does not refresh the buffer.
@end defun

@defun magit-git-wash washer &rest args

Execute Git with ARGS, inserting washed output at point.  Actually
first insert the raw output at point.  If there is no output call
@code{magit-cancel-section}.  Otherwise temporarily narrow the buffer to
the inserted text, move to its beginning, and then call function
WASHER with no argument.
@end defun

And now for the asynchronous variants.

@defun magit-run-git-async &rest args

Start Git, prepare for refresh, and return the process object.
ARGS is flattened and then used as arguments to Git.

Display the command line arguments in the echo area.

After Git returns some buffers are refreshed: the buffer that was
current when this function was called (if it is a Magit buffer and
still alive), as well as the respective Magit status buffer.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if @code{magit-revert-buffers} is non-nil.
@end defun

@defun magit-run-git-with-editor &rest args

Export GIT@math{_EDITOR} and start Git.  Also prepare for refresh and
return the process object.  ARGS is flattened and then used as
arguments to Git.

Display the command line arguments in the echo area.

After Git returns some buffers are refreshed: the buffer that was
current when this function was called (if it is a Magit buffer and
still alive), as well as the respective Magit status buffer.
@end defun

@defun magit-start-git &rest args

Start Git, prepare for refresh, and return the process object.

If INPUT is non-nil, it has to be a buffer or the name of an
existing buffer.  The buffer content becomes the processes
standard input.

Option @code{magit-git-executable} specifies the Git executable and option
@code{magit-git-global-arguments} specifies constant arguments.  The
remaining arguments ARGS specify arguments to Git.  They are
flattened before use.

After Git returns, some buffers are refreshed: the buffer that was
current when this function was called (if it is a Magit buffer and
still alive), as well as the respective Magit status buffer.
Unmodified buffers visiting files that are tracked in the current
repository are reverted if @code{magit-revert-buffers} is non-nil.
@end defun

@defun magit-start-process &rest args

Start PROGRAM, prepare for refresh, and return the process object.

If optional argument INPUT is non-nil, it has to be a buffer or
the name of an existing buffer.  The buffer content becomes the
processes standard input.

The process is started using @code{start-file-process} and then setup to
use the sentinel @code{magit-process-sentinel} and the filter
@code{magit-process-filter}.  Information required by these functions is
stored in the process object.  When this function returns the
process has not started to run yet so it is possible to override the
sentinel and filter.

After the process returns, @code{magit-process-sentinel} refreshes the
buffer that was current when @code{magit-start-process} was called (if it
is a Magit buffer and still alive), as well as the respective Magit
status buffer.  Unmodified buffers visiting files that are tracked
in the current repository are reverted if @code{magit-revert-buffers} is
non-nil.
@end defun

@defvar magit-this-process

The child process which is about to start.  This can be used to
change the filter and sentinel.
@end defvar

@defvar magit-process-raise-error

When this is non-nil, then @code{magit-process-sentinel} raises an error if
git exits with a non-zero exit status.  For debugging purposes.
@end defvar

@node Section plumbing
@section Section plumbing


@menu
* Creating sections::
* Section selection::
* Matching sections::
@end menu

@node Creating sections
@subsection Creating sections

@defmac magit-insert-section &rest args

Insert a section at point.

TYPE is the section type, a symbol.  Many commands that act on the
current section behave differently depending on that type.  Also if
a variable @code{magit-TYPE-section-map} exists, then use that as the
text-property @code{keymap} of all text belonging to the section (but this
may be overwritten in subsections).

Optional VALUE is the value of the section, usually a string that is
required when acting on the section.

When optional HIDE is non-nil collapse the section body by default,
i.e. when first creating the section, but not when refreshing the
buffer.  Otherwise, expand it by default.  This can be overwritten using
@code{magit-section-set-visibility-hook}.  When a section is recreated
during a refresh, then the visibility of predecessor is inherited
and HIDE is ignored (but the hook is still honored).

BODY is any number of forms that actually insert the section's
heading and body.  Optional NAME, if specified, has to be a symbol,
which is then bound to the struct of the section being inserted.

Before BODY is evaluated the @code{start} of the section object is set to
the value of @code{point} and after BODY was evaluated its @code{end} is set to
the new value of @code{point}; BODY is responsible for moving @code{point}
forward.

If it turns out inside BODY that the section is empty, then
@code{magit-cancel-section} can be used to abort and remove all traces of
the partially inserted section.  This can happen when creating a
section by washing Git's output and Git didn't actually output
anything this time around.
@end defmac

@defun magit-insert-heading &rest args

Insert the heading for the section currently being inserted.

This function should only be used inside @code{magit-insert-section}.

When called without any arguments, then just set the @code{content} slot of
the object representing the section being inserted to a marker at
@code{point}.  The section should only contain a single line when this
function is used like this.

When called with arguments ARGS, which have to be strings, then
insert those strings at point.  The section should not contain any
text before this happens and afterwards it should again only contain
a single line.  If the @code{face} property is set anywhere inside any of
these strings, then insert all of them unchanged.  Otherwise use the
@code{magit-section-heading} face for all inserted text.

The @code{content} property of the section struct is the end of the heading
(which lasts from @code{start} to @code{content}) and the beginning of the body
(which lasts from @code{content} to @code{end}).  If the value of @code{content} is nil,
then the section has no heading and its body cannot be collapsed.
If a section does have a heading then its height must be exactly one
line, including a trailing newline character.  This isn't enforced;
you are responsible for getting it right.  The only exception is
that this function does insert a newline character if necessary.
@end defun

@defun magit-cancel-section

Cancel the section currently being inserted.  This exits the
innermost call to @code{magit-insert-section} and removes all traces of
what has already happened inside that call.
@end defun

@defun magit-define-section-jumper sym title &optional value

Define an interactive function to go to section SYM.  TITLE is the
displayed title of the section.
@end defun

@node Section selection
@subsection Section selection

@defun magit-current-section

Return the section at point.
@end defun

@defun magit-region-sections

Return a list of the selected sections.

When the region is active and constitutes a valid section selection,
then return a list of all selected sections.  This is the case when
the region begins in the heading of a section and ends in the
heading of a sibling of that first section.  When the selection is
not valid then return nil.  Most commands that can act on the
selected sections, then instead just act on the current section, the
one point is in.

When the region looks like it would in any other buffer then the
selection is invalid.  When the selection is valid then the region
uses the @code{magit-section-highlight}.  This does not apply to diffs where
things get a bit more complicated, but even here if the region looks
like it usually does, then that's not a valid selection as far as
this function is concerned.
@end defun

@defun magit-region-values &rest types

Return a list of the values of the selected sections.

Also see @code{magit-region-sections} whose doc-string explains when a
region is a valid section selection.  If the region is not active
or is not a valid section selection, then return nil.  If optional
TYPES is non-nil then the selection not only has to be valid; the
types of all selected sections additionally have to match one of
TYPES, or nil is returned.
@end defun

@node Matching sections
@subsection Matching sections

@table @asis
@kindex M-x magit-describe-section
@cindex magit-describe-section
@item @kbd{M-x magit-describe-section} @tie{}@tie{}@tie{}@tie{}(@code{magit-describe-section})

Show information about the section at point.  This command is
intended for debugging purposes.

@end table

@defun magit-section-ident

Return an unique identifier for SECTION.  The return value has the
form @code{((TYPE . VALUE)...)}.
@end defun

@defun magit-get-section

Return the section identified by IDENT.  IDENT has to be a list as
returned by @code{magit-section-ident}.
@end defun

@defun magit-section-match condition &optional section

Return @code{t} if SECTION matches CONDITION.  SECTION defaults to the
section at point.

Conditions can take the following forms:
@itemize
@item
@code{(CONDITION...)}

matches if any of the CONDITIONs matches.


@item
@code{[TYPE...]}

matches if the first TYPE matches the type of the section at
point, the second matches that of its parent, and so on.


@item
@code{[* TYPE...]}

matches sections that match [TYPE@dots{}] and also recursively all
their child sections.


@item
@code{TYPE}

matches TYPE regardless of its parents.
@end itemize
Each TYPE is a symbol.  Note that is not necessary to specify all
TYPEs up to the root section as printed by @code{magit-describe-type},
unless of course your want to be that precise.
@end defun

@defun magit-section-when condition &rest body

If the section at point matches CONDITION evaluate BODY.

If the section matches evaluate BODY forms sequentially and return
the value of the last one, or if there are no BODY forms return the
value of the section.  If the section does not match return nil.

See @code{magit-section-match} for the forms CONDITION can take.
@end defun

@defun magit-section-case &rest clauses

Choose among clauses on the type of the section at point.

Each clause looks like (CONDITION BODY@dots{}).  The type of the
section is compared against each CONDITION; the BODY forms of the
first match are evaluated sequentially and the value of the last
form is returned.  Inside BODY the symbol @code{it} is bound to the
section at point.  If no clause succeeds or if there is no
section at point return nil.

See @code{magit-section-match} for the forms CONDITION can take.
Additionally a CONDITION of t is allowed in the final clause and
matches if no other CONDITION match, even if there is no section at
point.
@end defun

@defvar magit-root-section

The root section in the current buffer.  All other sections are
descendants of this section.  The value of this variable is set by
@code{magit-insert-section} and you should never modify it.
@end defvar

For diff related sections a few additional tools exist.

@defun magit-diff-type &optional section

Return the diff type of SECTION.

The returned type is one of the symbols @code{staged}, @code{unstaged}, @code{committed},
or @code{undefined}.  This type serves a similar purpose as the general
type common to all sections (which is stored in the @code{type} slot of the
corresponding @code{magit-section} struct) but takes additional information
into account.  When the SECTION isn't related to diffs and the
buffer containing it also isn't a diff-only buffer, then return nil.

Currently the type can also be one of @code{tracked} and @code{untracked}, but
these values are not handled explicitly in every place they should
be.  A possible fix could be to just return nil here.

The section has to be a @code{diff} or @code{hunk} section, or a section whose
children are of type @code{diff}.  If optional SECTION is nil, return the
diff type for the current section.  In buffers whose major mode is
@code{magit-diff-mode} SECTION is ignored and the type is determined using
other means.  In @code{magit-revision-mode} buffers the type is always
@code{committed}.
@end defun

@defun magit-diff-scope &optional section strict

Return the diff scope of SECTION or the selected section(s).

A diff's "scope" describes what part of a diff is selected, it is a
symbol, one of @code{region}, @code{hunk}, @code{hunks}, @code{file}, @code{files}, or @code{list}.  Do not
confuse this with the diff "type", as returned by @code{magit-diff-type}.

If optional SECTION is non-nil, then return the scope of that,
ignoring the sections selected by the region.  Otherwise return the
scope of the current section, or if the region is active and selects
a valid group of diff related sections, the type of these sections,
i.e. @code{hunks} or @code{files}.  If SECTION (or if the current section that
is nil) is a @code{hunk} section and the region starts and ends inside
the body of a that section, then the type is @code{region}.

If optional STRICT is non-nil then return nil if the diff type of
the section at point is @code{untracked} or the section at point is not
actually a @code{diff} but a @code{diffstat} section.
@end defun

@node Refreshing buffers
@section Refreshing buffers

All commands that create a new Magit buffer or change what is being
displayed in an existing buffer do so by calling @code{magit-mode-setup}.
Among other things, that function sets the buffer local values of
@code{default-directory} (to the top-level of the repository),
@code{magit-refresh-function}, and @code{magit-refresh-args}.

Buffers are refreshed by calling the function that is the local value
of @code{magit-refresh-function} (a function named @code{magit-*-refresh-buffer},
where @code{*} may be something like @code{diff}) with the value of
@code{magit-refresh-args} as arguments.

@defmac magit-mode-setup buffer switch-func mode refresh-func &optional refresh-args

This function displays and selects BUFFER, turns on MODE, and
refreshes a first time.

This function displays and optionally selects BUFFER by calling
@code{magit-mode-display-buffer} with BUFFER, MODE and SWITCH-FUNC as
arguments.  Then it sets the local value of @code{magit-refresh-function}
to REFRESH-FUNC and that of @code{magit-refresh-args} to REFRESH-ARGS.
Finally it creates the buffer content by calling REFRESH-FUNC with
REFRESH-ARGS as arguments.

All arguments are evaluated before switching to BUFFER.
@end defmac

@defun magit-mode-display-buffer buffer mode &optional switch-function

This function display BUFFER in some window and select it.  BUFFER
may be a buffer or a string, the name of a buffer.  The buffer is
returned.

Unless BUFFER is already displayed in the selected frame, store the
previous window configuration as a buffer local value, so that it
can later be restored by @code{magit-mode-bury-buffer}.

The buffer is displayed and selected using SWITCH-FUNCTION.  If that
is @code{nil} then @code{pop-to-buffer} is used if the current buffer's major mode
derives from @code{magit-mode}.  Otherwise @code{switch-to-buffer} is used.
@end defun

@defvar magit-refresh-function

The value of this buffer-local variable is the function used to
refresh the current buffer.  It is called with @code{magit-refresh-args} as
arguments.
@end defvar

@defvar magit-refresh-args

The list of arguments used by @code{magit-refresh-function} to refresh the
current buffer.  @code{magit-refresh-function} is called with these
arguments.

The value is usually set using @code{magit-mode-setup}, but in some cases
it's also useful to provide commands which can change the value.  For
example, the @code{magit-diff-refresh-popup} can be used to change any of
the arguments used to display the diff, without having to specify
again which differences should be shown.  @code{magit-diff-more-context},
@code{magit-diff-less-context}, and @code{magit-diff-default-context} change just
the @code{-U<N>} argument.  In both case this is done by changing the value
of this variable and then calling this @code{magit-refresh-function}.
@end defvar

@node Conventions
@section Conventions


@menu
* Confirmation and completion::
* Theming Faces::
@end menu

@node Confirmation and completion
@subsection Confirmation and completion

Dangerous operations that may lead to data loss have to be confirmed
by default.  With a multi-section selection, this is done using
questions that can be answered with "yes" or "no".  When the region isn't
active, or if it doesn't constitute a valid section selection, then
such commands instead read a single item in the minibuffer.  When the
value of the current section is among the possible choices, then that
is presented as default choice.  To confirm the action on a single
item, the user has to answer @code{RET} (instead of "yes"), and to abort, @code{C-g}
(instead of "no").  But alternatively the user may also select another
item, just like if the command had been invoked with no suitable
section at point at all.

@node Theming Faces
@subsection Theming Faces

The default theme uses blue for local branches, green for remote
branches, and goldenrod (brownish yellow) for tags.  When creating a
new theme, you should probably follow that example.  If your theme
already uses other colors, then stick to that.

In older releases these reference faces used to have a background
color and a box around them.  The basic default faces no longer do so,
to make Magit buffers much less noisy, and you should follow that
example at least with regards to boxes.  (Boxes were used in the past
to work around a conflict between the highlighting overlay and text
property backgrounds.  That's no longer necessary because highlighting no
longer causes other background colors to disappear.)  Alternatively
you can keep the background color and/or box, but then have to take
special care to adjust @code{magit-branch-current} accordingly.  By default
it looks mostly like @code{magit-branch-local}, but with a box (by default
the former is the only face that uses a box, exactly so that it sticks
out).  If the former also uses a box, then you have to make sure that
it differs in some other way from the latter.

The most difficult faces to theme are those related to diffs,
headings, highlighting, and the region.  There are faces that fall
into all four groups - expect to spend some time getting this right.

The @code{region} face in the default theme, in both the light and dark
variants, as well as in many other themes, distributed with Emacs or
by third-parties, is very ugly.  It is common to use a background
color that really sticks out, which is ugly but if that were the only
problem then it would be acceptable.  Unfortunately many themes also
set the foreground color, which ensures that all text within the
region is readable.  Without doing that there might be cases where
some foreground color is too close to the region background color to
still be readable.  But it also means that text within the region
loses all syntax highlighting.

I consider the work that went into getting the @code{region} face right to be
a good indicator for the general quality of a theme.  My
recommendation for the @code{region} face is this: use a background color
slightly different from the background color of the @code{default} face, and
do not set the foreground color at all.  So for a light theme you
might use a light (possibly tinted) gray as the background color of
@code{default} and a somewhat darker gray for the background of @code{region}.
That should usually be enough to not collide with the foreground color
of any other face.  But if some other faces also set a light gray as
background color, then you should also make sure it doesn't collide
with those (in some cases it might be acceptable though).

Magit only uses the @code{region} face when the region is "invalid" by its
own definition.  In a Magit buffer the region is used to either select
multiple sibling sections, so that commands which support it act on
all of these sections instead of just the current section, or to
select lines within a single hunk section.  In all other cases, the
section is considered invalid and Magit won't act on it.  But such
invalid sections happen, either because the user has not moved point
enough yet to make it valid or because she wants to use a non-magit
command to act on the region, e.g. @code{kill-region}.

So using the regular @code{region} face for invalid sections is a feature.  It
tells the user that Magit won't be able to act on it.  It's acceptable
if that face looks a bit odd and even (but less so) if it collides
with the background colors of section headings and other things that
have a background color.

Magit highlights the current section.  If a section has subsections,
then all of them are highlighted.  This is done using faces that have
"highlight" in their names.  For most sections, @code{magit-section-highlight}
is used for both the body and the heading.  Like the @code{region} face, it
should only set the background color to something similar to that of
@code{default}.  The highlight background color must be different from both
the @code{region} background color and the @code{default} background color.

For diff related sections Magit uses various faces to
highlight different parts of the selected section(s).  Note that hunk
headings, unlike all other section headings, by default have a
background color, because it is useful to have very visible separators
between hunks.  That face @code{magit-diff-hunk-heading}, should be different
from both @code{magit-diff-hunk-heading-highlight} and
@code{magit-section-highlight}, as well as from @code{magit-diff-context} and
@code{magit-diff-context-highlight}.  By default we do that by changing the
foreground color.  Changing the background color would lead to
complications, and there are already enough we cannot get around.
(Also note that it is generally a good idea for section headings to
always be bold, but only for sections that have subsections).

When there is a valid region selecting diff-related sibling sections,
i.e. multiple files or hunks, then the bodies of all these sections
use the respective highlight faces, but additionally the headings
instead use one of the faces @code{magit-diff-file-heading-selection} or
@code{magit-diff-hunk-heading-selection}.  These faces have to be different
from the regular highlight variants to provide explicit visual
indication that the region is active.

When theming diff related faces, start by setting the option
@code{magit-diff-refine-hunk} to @code{all}.  You might personally prefer to only
refine the current hunk or not use hunk refinement at all, but some of
the users of your theme want all hunks to be refined, so you have to
cater to that.

(Also turn on @code{magit-diff-highlight-indentation},
@code{magit-diff-highlight-trailing}, and @code{magit-diff-paint-whitespace}; and
insert some whitespace errors into the code you use for testing.)

For e.g. "added lines" you have to adjust three faces:
@code{magit-diff-added}, @code{magit-diff-added-highlight}, and
@code{smerge-refined-added}.  Make sure that the latter works well with both
of the former, as well as @code{smerge-other} and @code{diff-added}.  Then do the
same for the removed lines, context lines, lines added by us, and
lines added by them.  Also make sure the respective added, removed,
and context faces use approximately the same saturation for both the
highlighted and unhighlighted variants.  Also make sure the file and
diff headings work nicely with context lines (e.g. make them look
different).  Line faces should set both the foreground and the
background color.  For example, for added lines use two different
greens.

It's best if the foreground color of both the highlighted and the
unhighlighted variants are the same, so you will need to have to find
a color that works well on the highlight and unhighlighted background,
the refine background, and the highlight context background.  When
there is an hunk internal region, then the added- and removed-lines
background color is used only within that region.  Outside the region
the highlighted context background color is used.  This makes it
easier to see what is being staged.  With an hunk internal region the
hunk heading is shown using @code{magit-diff-hunk-heading-selection}, and so
are the thin lines that are added around the lines that fall within
the region.  The background color of that has to be distinct enough
from the various other involved background colors.

Nobody said this would be easy.  If your theme restricts itself to a
certain set of colors, then you should make an exception here.
Otherwise it would be impossible to make the diffs look good in each
and every variation.  Actually you might want to just stick to the
default definitions for these faces.  You have been warned.  Also
please note that if you do not get this right, this will in some cases
look to users like bugs in Magit - so please do it right or not at
all.

@node FAQ
@appendix FAQ

Below you find a list of frequently asked questions.  For a list of
frequently @strong{and recently} asked questions, i.e. questions that haven't
made it into the manual yet, see @uref{https://github.com/magit/magit/wiki/FAQ}.

@menu
* Magit is slow::
* I am having problems committing::
* I am using an Emacs release older than 24.4: I am using an Emacs release older than 244. 
* I am using a Git release older than 1.9.4: I am using a Git release older than 194. 
* I am using MS Windows and cannot push with Magit::
* How to install the gitman info manual?::
* How can I show Git's output?::
* Expanding a file to show the diff causes it to disappear::
* Magit claims repository accessed using Tramp does not exist::
* Can Magit be used as ediff-version-control-package?::
* How to show diffs for gpg-encrypted files?::
* Emacs 24.5 hangs when loading Magit: Emacs 245 hangs when loading Magit. 
@end menu

@node Magit is slow
@section Magit is slow

See @ref{Performance,Performance}.

@node I am having problems committing
@section I am having problems committing

That likely means that Magit is having problems finding an appropriate
emacsclient executable.  See @ref{Configuring With-Editor,,,with-editor,}
and @ref{Debugging,,,with-editor,}.

@node I am using an Emacs release older than 244
@section I am using an Emacs release older than 24.4

At least version 24.4 is required.  There is no way around it.

If you own the machine you work on, then consider updating to the
latest release provided by your distribution.  If it doesn't feature a
recent enough release, then you will have to use a backport package or
build Emacs from source.

Installing Emacs from source is quite simple. See the instructions at
@uref{http://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL} and
@uref{http://git.savannah.gnu.org/cgit/emacs.git/tree/INSTALL.REPO} to get an
idea of that this involves.  But when you perform the installation
then use the instructions for the release you are actually installing.

Unfortunately these instructions do not cover the hardest part (which
is the hardest part exactly because it is not covered there):
installing the build time dependencies.

For that you'll need to perform a web search and find an appropriate
tutorial for your distribution.  If you think you should not have had
to do that yourself, then consider informing me about the resources
that helped you figure what to do for your specific setup, so that I
can post a link here.  That way those coming after you have it easier.

@node I am using a Git release older than 194
@section I am using a Git release older than 1.9.4

At least version 1.9.4 is required.  There is no way around it.

If you own the machine, then consider updating to the latest release
provided by your distribution.  If it doesn't feature a recent enough
release, then you will have to use a backport package or build Git
from source.

Installing Git from source is quite simple. See the instructions at
@uref{https://github.com/git/git/blob/master/INSTALL} to get an idea of that
this involves.  But when you perform the installation then use the
instructions for the release you are actually installing.

@node I am using MS Windows and cannot push with Magit
@section I am using MS Windows and cannot push with Magit

It's almost certain that Magit is only incidental to this issue.  It
is much more likely that this is a configuration issue, even if you
can push on the command line.

Detailed setup instructions can be found at
@uref{https://github.com/magit/magit/wiki/Pushing-with-Magit-from-Windows}.

@node How to install the gitman info manual?
@section How to install the gitman info manual?

Git's manpages can be exported as an info manual called @code{gitman}.
Magit's own info manual links to nodes in that manual instead of the
actual manpages because texinfo sadly doesn't support linking to
manpages.

Unfortunately many distributions do not install the @code{gitman} manual by
default.  Some distributions may provide a separate package containing
the info manual.  Please let me know the name of that package for your
distribution, so that I can mention here.

If the distribution you are using does not offer a package that
contains the @code{gitman} manual, then you have to install it manually.
Clone Git's own Git repository, checkout the tag corresponding to the
Git release you have installed, and follow the instructions in
@code{INSTALL}.  The relevant make targets are @code{info} and @code{install-info}.

Alternatively you may add this advice to your @code{init.el} file.

@lisp
(defadvice Info-follow-nearest-node (around gitman activate)
  "When encountering a cross reference to the `gitman' info
manual, then instead of following that cross reference show
the actual manpage using the function `man'."
  (let ((node (Info-get-token
               (point) "\\*note[ \n\t]+"
               "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?")))
    (if (and node (string-match "^(gitman)\\(.+\\)" node))
        (progn (require 'man)
               (man (match-string 1 node)))
      ad-do-it)))
@end lisp

Or if you are using MS Windows and @code{man} is not available, use this
variation with used the Emacs Lisp implementation provided by the
@code{woman} package.

@lisp
(defadvice Info-follow-nearest-node (around gitman activate)
  "When encountering a cross reference to the `gitman' info
manual, then instead of following that cross reference show
the actual manpage using the function `woman'."
  (let ((node (Info-get-token
               (point) "\\*note[ \n\t]+"
               "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?")))
    (if (and node (string-match "^(gitman)\\(.+\\)" node))
        (progn (require 'woman)
               (woman (match-string 1 node)))
      ad-do-it)))
@end lisp

Did I mention that texinfo cross reference are just awful?  (This is
just one of many issues.)

@node How can I show Git's output?
@section How can I show Git's output?

To show the output of recently run git commands, press @code{$} (or, if that
isn't available, @code{M-x magit-process-buffer}).  This will show a buffer
containing a section per git invocation; as always press @code{TAB} to expand
or collapse them.

By default git's output is only inserted into the process buffer if it
is run for side-effects.  When the output is consumed in some way then
also inserting it into the process buffer would be to expensive.  For
debugging purposes it's possible to do so anyway by setting
@code{magit-git-debug} to @code{t}.

@node Expanding a file to show the diff causes it to disappear
@section Expanding a file to show the diff causes it to disappear

This is probably caused by a change of a @code{diff.*} Git variable.  You
probably set that variable for a reason, and should therefore
only undo that setting in Magit by customizing
@code{magit-git-global-arguments}.

@node Magit claims repository accessed using Tramp does not exist
@section Magit claims repository accessed using Tramp does not exist

"There is no Git repository in /ssh:host:/path/to/repository".

Magit requires at least version @code{1.9.4}.  When connecting to a remote
machine using Tramp it requires that same version on that remote.

By default Tramp searches for programs in the directories given by the
output of @code{getconf PATH} on the remote host.  Therefore, if the remote
git version that you intend to use lives in a non-standard location,
you may need to alter @code{tramp-remote-path}.  Consult the Tramp
documentation on remote programs
@uref{http://www.gnu.org/software/emacs/manual/html_node/tramp/Remote-Programs.html}
for details.

There are others reasons why Magit/Git might think that there is no
repository where there actually is one, but when this is being
reported then it's usually the above.

@node Can Magit be used as ediff-version-control-package?
@section Can Magit be used as ediff-version-control-package?

No, it cannot.  For that to work the functions @code{ediff-magit-internal}
and @code{ediff-magit-merge-internal} would have to be implemented, and they
are not.  These two functions are only used by the three commands
@code{ediff-revision}, @code{ediff-merge-revisions-with-ancestor}, and
@code{ediff-merge-revisions}.

These commands only delegate the task of populating buffers with
certain revisions to the "internal" functions.  The equally important
task of determining which revisions are to be compared/merged is not
delegated.  Instead this is done without any support whatsoever, from
the version control package/system - meaning that the user has to
enter the revisions explicitly.  Instead of implementing
@code{ediff-magit-internal} we provide @code{magit-ediff-compare}, which handles
both tasks like it is 2005.

The other commands @code{ediff-merge-revisions} and
@code{ediff-merge-revisions-with-ancestor} are normally not what you want
when using a modern version control system like Git.  Instead of
letting the user resolve only those conflicts which Git could not
resolve on its own, they throw away all work done by Git and then
expect the user to manually merge all conflicts, including those that
had already been resolved.  That made sense back in the days when
version control systems couldn't merge (or so I have been told), but
not anymore.  Once in a blue moon you might actually want to see all
conflicts, in which case you @strong{can} use these commands, which then use
@code{ediff-vc-merge-internal}.  So we don't actually have to implement
@code{ediff-magit-merge-internal}.  Instead we provide the more useful
command @code{magit-ediff-resolve} which only shows yet-to-be resolved
conflicts.

@node How to show diffs for gpg-encrypted files?
@section How to show diffs for gpg-encrypted files?

Git supports showing diffs for encrypted files, but has to be told to
do so.  Since Magit just uses Git to get the diffs, configuring Git
also affects the diffs displayed inside Magit.

@example
git config --global diff.gpg.textconv "gpg --no-tty --decrypt"
echo "*.gpg filter=gpg diff=gpg" > .gitattributes
@end example

@node Emacs 245 hangs when loading Magit
@section Emacs 24.5 hangs when loading Magit

This is actually triggered by loading Tramp.  See
@uref{https://debbugs.gnu.org/cgi/bugreport.cgi?bug~20015} for details. You
can work around the problem by setting
@code{tramp-ssh-controlmaster-options}. Changing your DNS server (e.g. to
Google's @code{8.8.8.8}) may also be sufficient to work around the issue.

@node Keystroke Index
@appendix Keystroke Index

@printindex ky

@node Command Index
@appendix Command Index

@printindex cp

@node Function Index
@appendix Function Index

@printindex fn

@node Variable Index
@appendix Variable Index

@printindex vr

@bye