[{"data":1,"prerenderedAt":1211},["ShallowReactive",2],{"page-en-\u002Fblog\u002Fgit-commands-every-developer-should-know":3},{"id":4,"title":5,"body":6,"date":1200,"description":1201,"extension":1202,"meta":1203,"navigation":230,"path":1204,"seo":1205,"stem":1206,"tags":1207,"translation":1209,"__hash__":1210},"pages_en\u002Fen\u002Fblog\u002Fgit-commands-every-developer-should-know.md","Git Commands Every Developer Should Know",{"type":7,"value":8,"toc":1190},"minimark",[9,14,27,38,42,45,131,134,184,188,199,328,339,430,434,440,538,541,602,651,654,673,677,690,827,838,842,845,908,919,925,1006,1017,1053,1057,1060,1116,1119,1166,1170,1186],[10,11,13],"h2",{"id":12},"introduction","Introduction",[15,16,17,18,22,23,26],"p",{},"Most of your daily Git work is done with roughly 20 commands; this post collects them in order of use, with examples. Whether you're just starting out or have been using Git for years, bookmark this page for a quick reminder of the difference between ",[19,20,21],"code",{},"reset"," and ",[19,24,25],{},"revert",", or how to recover a lost commit.",[15,28,29,30,33,34,37],{},"The examples use ",[19,31,32],{},"main"," as the default branch and ",[19,35,36],{},"origin"," as the remote name.",[10,39,41],{"id":40},"_1-setup-and-configuration","1. Setup and configuration",[15,43,44],{},"When you first install Git, you only need to introduce yourself once; this information is written into every commit.",[46,47,52],"pre",{"className":48,"code":49,"language":50,"meta":51,"style":51},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","git config --global user.name \"Your Name\"\ngit config --global user.email \"you@example.com\"\ngit config --global init.defaultBranch main\ngit config --list          # show all settings\n","bash","",[19,53,54,83,102,117],{"__ignoreMap":51},[55,56,59,63,67,70,73,77,80],"span",{"class":57,"line":58},"line",1,[55,60,62],{"class":61},"sBMFI","git",[55,64,66],{"class":65},"sfazB"," config",[55,68,69],{"class":65}," --global",[55,71,72],{"class":65}," user.name",[55,74,76],{"class":75},"sMK4o"," \"",[55,78,79],{"class":65},"Your Name",[55,81,82],{"class":75},"\"\n",[55,84,86,88,90,92,95,97,100],{"class":57,"line":85},2,[55,87,62],{"class":61},[55,89,66],{"class":65},[55,91,69],{"class":65},[55,93,94],{"class":65}," user.email",[55,96,76],{"class":75},[55,98,99],{"class":65},"you@example.com",[55,101,82],{"class":75},[55,103,105,107,109,111,114],{"class":57,"line":104},3,[55,106,62],{"class":61},[55,108,66],{"class":65},[55,110,69],{"class":65},[55,112,113],{"class":65}," init.defaultBranch",[55,115,116],{"class":65}," main\n",[55,118,120,122,124,127],{"class":57,"line":119},4,[55,121,62],{"class":61},[55,123,66],{"class":65},[55,125,126],{"class":65}," --list",[55,128,130],{"class":129},"sHwdD","          # show all settings\n",[15,132,133],{},"To start a new project or download an existing repository:",[46,135,137],{"className":48,"code":136,"language":50,"meta":51,"style":51},"git init                                   # turn the current folder into a repo\ngit clone https:\u002F\u002Fgithub.com\u002Fuser\u002Fproject.git\ngit clone \u003Curl> new-folder-name            # clone into a different folder\n",[19,138,139,149,159],{"__ignoreMap":51},[55,140,141,143,146],{"class":57,"line":58},[55,142,62],{"class":61},[55,144,145],{"class":65}," init",[55,147,148],{"class":129},"                                   # turn the current folder into a repo\n",[55,150,151,153,156],{"class":57,"line":85},[55,152,62],{"class":61},[55,154,155],{"class":65}," clone",[55,157,158],{"class":65}," https:\u002F\u002Fgithub.com\u002Fuser\u002Fproject.git\n",[55,160,161,163,165,168,171,175,178,181],{"class":57,"line":104},[55,162,62],{"class":61},[55,164,155],{"class":65},[55,166,167],{"class":75}," \u003C",[55,169,170],{"class":65},"ur",[55,172,174],{"class":173},"sTEyZ","l",[55,176,177],{"class":75},">",[55,179,180],{"class":65}," new-folder-name",[55,182,183],{"class":129},"            # clone into a different folder\n",[10,185,187],{"id":186},"_2-everyday-workflow","2. Everyday workflow",[15,189,190,191,194,195,198],{},"Changes move through three stages: working directory → staging area (",[19,192,193],{},"add",") → repository history (",[19,196,197],{},"commit",").",[46,200,202],{"className":48,"code":201,"language":50,"meta":51,"style":51},"git status                 # what changed, what's staged\ngit status -s              # short format\n\ngit add File.java          # stage a single file\ngit add .                  # stage all changes\ngit add -p                 # stage changes interactively, chunk by chunk\n\ngit commit -m \"Add login validation\"\ngit commit -am \"Message\"   # add + commit tracked files\ngit commit --amend         # fix the last commit (before pushing!)\n",[19,203,204,214,226,232,245,258,271,276,294,315],{"__ignoreMap":51},[55,205,206,208,211],{"class":57,"line":58},[55,207,62],{"class":61},[55,209,210],{"class":65}," status",[55,212,213],{"class":129},"                 # what changed, what's staged\n",[55,215,216,218,220,223],{"class":57,"line":85},[55,217,62],{"class":61},[55,219,210],{"class":65},[55,221,222],{"class":65}," -s",[55,224,225],{"class":129},"              # short format\n",[55,227,228],{"class":57,"line":104},[55,229,231],{"emptyLinePlaceholder":230},true,"\n",[55,233,234,236,239,242],{"class":57,"line":119},[55,235,62],{"class":61},[55,237,238],{"class":65}," add",[55,240,241],{"class":65}," File.java",[55,243,244],{"class":129},"          # stage a single file\n",[55,246,248,250,252,255],{"class":57,"line":247},5,[55,249,62],{"class":61},[55,251,238],{"class":65},[55,253,254],{"class":65}," .",[55,256,257],{"class":129},"                  # stage all changes\n",[55,259,261,263,265,268],{"class":57,"line":260},6,[55,262,62],{"class":61},[55,264,238],{"class":65},[55,266,267],{"class":65}," -p",[55,269,270],{"class":129},"                 # stage changes interactively, chunk by chunk\n",[55,272,274],{"class":57,"line":273},7,[55,275,231],{"emptyLinePlaceholder":230},[55,277,279,281,284,287,289,292],{"class":57,"line":278},8,[55,280,62],{"class":61},[55,282,283],{"class":65}," commit",[55,285,286],{"class":65}," -m",[55,288,76],{"class":75},[55,290,291],{"class":65},"Add login validation",[55,293,82],{"class":75},[55,295,297,299,301,304,306,309,312],{"class":57,"line":296},9,[55,298,62],{"class":61},[55,300,283],{"class":65},[55,302,303],{"class":65}," -am",[55,305,76],{"class":75},[55,307,308],{"class":65},"Message",[55,310,311],{"class":75},"\"",[55,313,314],{"class":129},"   # add + commit tracked files\n",[55,316,318,320,322,325],{"class":57,"line":317},10,[55,319,62],{"class":61},[55,321,283],{"class":65},[55,323,324],{"class":65}," --amend",[55,326,327],{"class":129},"         # fix the last commit (before pushing!)\n",[15,329,330,331,334,335,338],{},"Use ",[19,332,333],{},"diff"," to see what changed and ",[19,336,337],{},"log"," to review history:",[46,340,342],{"className":48,"code":341,"language":50,"meta":51,"style":51},"git diff                   # unstaged changes\ngit diff --staged          # changes about to be committed\ngit log --oneline --graph --all   # readable branch history\ngit log -p File.java       # history of a single file\ngit show \u003Ccommit>          # details of one commit\ngit blame File.java        # who changed which line\n",[19,343,344,354,366,385,398,418],{"__ignoreMap":51},[55,345,346,348,351],{"class":57,"line":58},[55,347,62],{"class":61},[55,349,350],{"class":65}," diff",[55,352,353],{"class":129},"                   # unstaged changes\n",[55,355,356,358,360,363],{"class":57,"line":85},[55,357,62],{"class":61},[55,359,350],{"class":65},[55,361,362],{"class":65}," --staged",[55,364,365],{"class":129},"          # changes about to be committed\n",[55,367,368,370,373,376,379,382],{"class":57,"line":104},[55,369,62],{"class":61},[55,371,372],{"class":65}," log",[55,374,375],{"class":65}," --oneline",[55,377,378],{"class":65}," --graph",[55,380,381],{"class":65}," --all",[55,383,384],{"class":129},"   # readable branch history\n",[55,386,387,389,391,393,395],{"class":57,"line":119},[55,388,62],{"class":61},[55,390,372],{"class":65},[55,392,267],{"class":65},[55,394,241],{"class":65},[55,396,397],{"class":129},"       # history of a single file\n",[55,399,400,402,405,407,410,413,415],{"class":57,"line":247},[55,401,62],{"class":61},[55,403,404],{"class":65}," show",[55,406,167],{"class":75},[55,408,409],{"class":65},"commi",[55,411,412],{"class":173},"t",[55,414,177],{"class":75},[55,416,417],{"class":129},"          # details of one commit\n",[55,419,420,422,425,427],{"class":57,"line":260},[55,421,62],{"class":61},[55,423,424],{"class":65}," blame",[55,426,241],{"class":65},[55,428,429],{"class":129},"        # who changed which line\n",[10,431,433],{"id":432},"_3-branching","3. Branching",[15,435,436,437,439],{},"Opening a separate branch for every feature or bug fix is the easiest way to keep ",[19,438,32],{}," clean.",[46,441,443],{"className":48,"code":442,"language":50,"meta":51,"style":51},"git branch                 # local branches\ngit branch -a              # including remote branches\ngit switch -c feature\u002Flogin     # create and switch to a new branch\ngit switch main                 # switch branches\ngit checkout -b feature\u002Flogin   # older syntax, same job\ngit branch -d feature\u002Flogin     # delete a merged branch\ngit branch -D feature\u002Flogin     # force delete\n",[19,444,445,455,467,483,495,510,524],{"__ignoreMap":51},[55,446,447,449,452],{"class":57,"line":58},[55,448,62],{"class":61},[55,450,451],{"class":65}," branch",[55,453,454],{"class":129},"                 # local branches\n",[55,456,457,459,461,464],{"class":57,"line":85},[55,458,62],{"class":61},[55,460,451],{"class":65},[55,462,463],{"class":65}," -a",[55,465,466],{"class":129},"              # including remote branches\n",[55,468,469,471,474,477,480],{"class":57,"line":104},[55,470,62],{"class":61},[55,472,473],{"class":65}," switch",[55,475,476],{"class":65}," -c",[55,478,479],{"class":65}," feature\u002Flogin",[55,481,482],{"class":129},"     # create and switch to a new branch\n",[55,484,485,487,489,492],{"class":57,"line":119},[55,486,62],{"class":61},[55,488,473],{"class":65},[55,490,491],{"class":65}," main",[55,493,494],{"class":129},"                 # switch branches\n",[55,496,497,499,502,505,507],{"class":57,"line":247},[55,498,62],{"class":61},[55,500,501],{"class":65}," checkout",[55,503,504],{"class":65}," -b",[55,506,479],{"class":65},[55,508,509],{"class":129},"   # older syntax, same job\n",[55,511,512,514,516,519,521],{"class":57,"line":260},[55,513,62],{"class":61},[55,515,451],{"class":65},[55,517,518],{"class":65}," -d",[55,520,479],{"class":65},[55,522,523],{"class":129},"     # delete a merged branch\n",[55,525,526,528,530,533,535],{"class":57,"line":273},[55,527,62],{"class":61},[55,529,451],{"class":65},[55,531,532],{"class":65}," -D",[55,534,479],{"class":65},[55,536,537],{"class":129},"     # force delete\n",[15,539,540],{},"There are two ways to combine branches:",[46,542,544],{"className":48,"code":543,"language":50,"meta":51,"style":51},"git switch main\ngit merge feature\u002Flogin    # merge with a merge commit\ngit switch feature\u002Flogin\ngit rebase main            # replay commits on top of main\ngit rebase -i HEAD~3       # edit\u002Fsquash the last 3 commits\n",[19,545,546,554,566,575,587],{"__ignoreMap":51},[55,547,548,550,552],{"class":57,"line":58},[55,549,62],{"class":61},[55,551,473],{"class":65},[55,553,116],{"class":65},[55,555,556,558,561,563],{"class":57,"line":85},[55,557,62],{"class":61},[55,559,560],{"class":65}," merge",[55,562,479],{"class":65},[55,564,565],{"class":129},"    # merge with a merge commit\n",[55,567,568,570,572],{"class":57,"line":104},[55,569,62],{"class":61},[55,571,473],{"class":65},[55,573,574],{"class":65}," feature\u002Flogin\n",[55,576,577,579,582,584],{"class":57,"line":119},[55,578,62],{"class":61},[55,580,581],{"class":65}," rebase",[55,583,491],{"class":65},[55,585,586],{"class":129},"            # replay commits on top of main\n",[55,588,589,591,593,596,599],{"class":57,"line":247},[55,590,62],{"class":61},[55,592,581],{"class":65},[55,594,595],{"class":65}," -i",[55,597,598],{"class":65}," HEAD~3",[55,600,601],{"class":129},"       # edit\u002Fsquash the last 3 commits\n",[603,604,605,621],"table",{},[606,607,608],"thead",{},[609,610,611,615,618],"tr",{},[612,613,614],"th",{},"Command",[612,616,617],{},"What it does",[612,619,620],{},"When to use",[622,623,624,638],"tbody",{},[609,625,626,632,635],{},[627,628,629],"td",{},[19,630,631],{},"merge",[627,633,634],{},"Preserves history, adds a merge commit",[627,636,637],{},"On shared branches",[609,639,640,645,648],{},[627,641,642],{},[19,643,644],{},"rebase",[627,646,647],{},"Makes history linear",[627,649,650],{},"On local branches not yet pushed",[15,652,653],{},"Golden rule: never rebase a pushed branch that others also use.",[15,655,656,657,660,661,664,665,668,669,672],{},"If a conflict occurs, fix the files, run ",[19,658,659],{},"git add",", then continue with ",[19,662,663],{},"git merge --continue"," or ",[19,666,667],{},"git rebase --continue","; use ",[19,670,671],{},"--abort"," to give up.",[10,674,676],{"id":675},"_4-working-with-remotes","4. Working with remotes",[15,678,679,682,683,686,687,689],{},[19,680,681],{},"fetch"," only downloads; ",[19,684,685],{},"pull"," downloads and merges. When in doubt, ",[19,688,681],{}," first and see what's coming in.",[46,691,693],{"className":48,"code":692,"language":50,"meta":51,"style":51},"git remote -v                          # linked remotes\ngit remote add origin \u003Curl>            # add a remote\n\ngit fetch origin                       # download changes, don't merge\ngit pull                               # fetch + merge\ngit pull --rebase                      # fetch + rebase (cleaner history)\n\ngit push                               # push the current branch\ngit push -u origin feature\u002Flogin       # first push, set upstream\ngit push --force-with-lease            # safe force-push after a rebase\ngit push origin --delete feature\u002Flogin # delete a remote branch\n",[19,694,695,708,730,734,746,756,768,772,782,798,810],{"__ignoreMap":51},[55,696,697,699,702,705],{"class":57,"line":58},[55,698,62],{"class":61},[55,700,701],{"class":65}," remote",[55,703,704],{"class":65}," -v",[55,706,707],{"class":129},"                          # linked remotes\n",[55,709,710,712,714,716,719,721,723,725,727],{"class":57,"line":85},[55,711,62],{"class":61},[55,713,701],{"class":65},[55,715,238],{"class":65},[55,717,718],{"class":65}," origin",[55,720,167],{"class":75},[55,722,170],{"class":65},[55,724,174],{"class":173},[55,726,177],{"class":75},[55,728,729],{"class":129},"            # add a remote\n",[55,731,732],{"class":57,"line":104},[55,733,231],{"emptyLinePlaceholder":230},[55,735,736,738,741,743],{"class":57,"line":119},[55,737,62],{"class":61},[55,739,740],{"class":65}," fetch",[55,742,718],{"class":65},[55,744,745],{"class":129},"                       # download changes, don't merge\n",[55,747,748,750,753],{"class":57,"line":247},[55,749,62],{"class":61},[55,751,752],{"class":65}," pull",[55,754,755],{"class":129},"                               # fetch + merge\n",[55,757,758,760,762,765],{"class":57,"line":260},[55,759,62],{"class":61},[55,761,752],{"class":65},[55,763,764],{"class":65}," --rebase",[55,766,767],{"class":129},"                      # fetch + rebase (cleaner history)\n",[55,769,770],{"class":57,"line":273},[55,771,231],{"emptyLinePlaceholder":230},[55,773,774,776,779],{"class":57,"line":278},[55,775,62],{"class":61},[55,777,778],{"class":65}," push",[55,780,781],{"class":129},"                               # push the current branch\n",[55,783,784,786,788,791,793,795],{"class":57,"line":296},[55,785,62],{"class":61},[55,787,778],{"class":65},[55,789,790],{"class":65}," -u",[55,792,718],{"class":65},[55,794,479],{"class":65},[55,796,797],{"class":129},"       # first push, set upstream\n",[55,799,800,802,804,807],{"class":57,"line":317},[55,801,62],{"class":61},[55,803,778],{"class":65},[55,805,806],{"class":65}," --force-with-lease",[55,808,809],{"class":129},"            # safe force-push after a rebase\n",[55,811,813,815,817,819,822,824],{"class":57,"line":812},11,[55,814,62],{"class":61},[55,816,778],{"class":65},[55,818,718],{"class":65},[55,820,821],{"class":65}," --delete",[55,823,479],{"class":65},[55,825,826],{"class":129}," # delete a remote branch\n",[15,828,829,830,833,834,837],{},"Always use ",[19,831,832],{},"--force-with-lease"," instead of ",[19,835,836],{},"--force",": it stops the push if someone else has pushed since you last looked.",[10,839,841],{"id":840},"_5-undoing-mistakes","5. Undoing mistakes",[15,843,844],{},"The right command depends on what you want to undo:",[603,846,847,856],{},[606,848,849],{},[609,850,851,854],{},[612,852,853],{},"Situation",[612,855,614],{},[622,857,858,868,878,888,898],{},[609,859,860,863],{},[627,861,862],{},"Discard unsaved changes in a file",[627,864,865],{},[19,866,867],{},"git restore File.java",[609,869,870,873],{},[627,871,872],{},"Unstage a file",[627,874,875],{},[19,876,877],{},"git restore --staged File.java",[609,879,880,883],{},[627,881,882],{},"Undo the last commit, keep the changes",[627,884,885],{},[19,886,887],{},"git reset --soft HEAD~1",[609,889,890,893],{},[627,891,892],{},"Delete the last commit and its changes",[627,894,895],{},[19,896,897],{},"git reset --hard HEAD~1",[609,899,900,903],{},[627,901,902],{},"Safely undo a pushed commit",[627,904,905],{},[19,906,907],{},"git revert \u003Ccommit>",[15,909,910,912,913,915,916,918],{},[19,911,21],{}," rewrites history, while ",[19,914,25],{}," adds a new commit that undoes the change; always use ",[19,917,25],{}," on shared branches.",[15,920,330,921,924],{},[19,922,923],{},"stash"," to set aside unfinished work:",[46,926,928],{"className":48,"code":927,"language":50,"meta":51,"style":51},"git stash                      # stash your changes\ngit stash push -m \"half-done login\"   # stash with a name\ngit stash list                 # list stashes\ngit stash pop                  # apply and drop the latest stash\ngit stash apply stash@{1}      # apply a specific stash\n",[19,929,930,940,960,972,984],{"__ignoreMap":51},[55,931,932,934,937],{"class":57,"line":58},[55,933,62],{"class":61},[55,935,936],{"class":65}," stash",[55,938,939],{"class":129},"                      # stash your changes\n",[55,941,942,944,946,948,950,952,955,957],{"class":57,"line":85},[55,943,62],{"class":61},[55,945,936],{"class":65},[55,947,778],{"class":65},[55,949,286],{"class":65},[55,951,76],{"class":75},[55,953,954],{"class":65},"half-done login",[55,956,311],{"class":75},[55,958,959],{"class":129},"   # stash with a name\n",[55,961,962,964,966,969],{"class":57,"line":104},[55,963,62],{"class":61},[55,965,936],{"class":65},[55,967,968],{"class":65}," list",[55,970,971],{"class":129},"                 # list stashes\n",[55,973,974,976,978,981],{"class":57,"line":119},[55,975,62],{"class":61},[55,977,936],{"class":65},[55,979,980],{"class":65}," pop",[55,982,983],{"class":129},"                  # apply and drop the latest stash\n",[55,985,986,988,990,993,996,1000,1003],{"class":57,"line":247},[55,987,62],{"class":61},[55,989,936],{"class":65},[55,991,992],{"class":65}," apply",[55,994,995],{"class":65}," stash@{",[55,997,999],{"class":998},"sbssI","1",[55,1001,1002],{"class":65},"}",[55,1004,1005],{"class":129},"      # apply a specific stash\n",[15,1007,1008,1009,1012,1013,1016],{},"Your last resort is ",[19,1010,1011],{},"reflog",": even commits \"lost\" after ",[19,1014,1015],{},"reset --hard"," show up here.",[46,1018,1020],{"className":48,"code":1019,"language":50,"meta":51,"style":51},"git reflog                     # everywhere HEAD has been\ngit reset --hard HEAD@{2}      # go back to that point\n",[19,1021,1022,1032],{"__ignoreMap":51},[55,1023,1024,1026,1029],{"class":57,"line":58},[55,1025,62],{"class":61},[55,1027,1028],{"class":65}," reflog",[55,1030,1031],{"class":129},"                     # everywhere HEAD has been\n",[55,1033,1034,1036,1039,1042,1045,1048,1050],{"class":57,"line":85},[55,1035,62],{"class":61},[55,1037,1038],{"class":65}," reset",[55,1040,1041],{"class":65}," --hard",[55,1043,1044],{"class":65}," HEAD@{",[55,1046,1047],{"class":998},"2",[55,1049,1002],{"class":65},[55,1051,1052],{"class":129},"      # go back to that point\n",[10,1054,1056],{"id":1055},"_6-time-saving-tips","6. Time-saving tips",[15,1058,1059],{},"Define aliases for commands you type often:",[46,1061,1063],{"className":48,"code":1062,"language":50,"meta":51,"style":51},"git config --global alias.st status\ngit config --global alias.co checkout\ngit config --global alias.lg \"log --oneline --graph --all\"\n# Now: git st, git lg\n",[19,1064,1065,1079,1093,1111],{"__ignoreMap":51},[55,1066,1067,1069,1071,1073,1076],{"class":57,"line":58},[55,1068,62],{"class":61},[55,1070,66],{"class":65},[55,1072,69],{"class":65},[55,1074,1075],{"class":65}," alias.st",[55,1077,1078],{"class":65}," status\n",[55,1080,1081,1083,1085,1087,1090],{"class":57,"line":85},[55,1082,62],{"class":61},[55,1084,66],{"class":65},[55,1086,69],{"class":65},[55,1088,1089],{"class":65}," alias.co",[55,1091,1092],{"class":65}," checkout\n",[55,1094,1095,1097,1099,1101,1104,1106,1109],{"class":57,"line":104},[55,1096,62],{"class":61},[55,1098,66],{"class":65},[55,1100,69],{"class":65},[55,1102,1103],{"class":65}," alias.lg",[55,1105,76],{"class":75},[55,1107,1108],{"class":65},"log --oneline --graph --all",[55,1110,82],{"class":75},[55,1112,1113],{"class":57,"line":119},[55,1114,1115],{"class":129},"# Now: git st, git lg\n",[15,1117,1118],{},"A few small habits make a big difference:",[1120,1121,1122,1141,1144,1150,1157],"ul",{},[1123,1124,1125,1126,1129,1130,1133,1134,1133,1137,1140],"li",{},"Add a ",[19,1127,1128],{},".gitignore"," file in the project's first commit (",[19,1131,1132],{},"target\u002F",", ",[19,1135,1136],{},"*.class",[19,1138,1139],{},".idea\u002F",", etc.).",[1123,1142,1143],{},"Write commit messages in the imperative mood and keep them short: \"Add login validation\".",[1123,1145,330,1146,1149],{},[19,1147,1148],{},"git bisect"," to binary-search for the commit that introduced a bug.",[1123,1151,1152,1153,1156],{},"Move a specific commit to another branch with ",[19,1154,1155],{},"git cherry-pick \u003Ccommit>",".",[1123,1158,1159,1160,22,1163,1156],{},"Tag releases with ",[19,1161,1162],{},"git tag -a v1.0 -m \"First release\"",[19,1164,1165],{},"git push --tags",[10,1167,1169],{"id":1168},"conclusion","Conclusion",[15,1171,1172,1173,22,1175,1177,1178,1133,1180,1182,1183,1185],{},"You'll memorize most of these commands in your first week; the lifesavers like ",[19,1174,1011],{},[19,1176,25],{}," are what you'll come back to this page for when you need them. The best practice is to open a throwaway repo and learn ",[19,1179,21],{},[19,1181,644],{},", and ",[19,1184,923],{}," by breaking things there.",[1187,1188,1189],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":51,"searchDepth":85,"depth":85,"links":1191},[1192,1193,1194,1195,1196,1197,1198,1199],{"id":12,"depth":85,"text":13},{"id":40,"depth":85,"text":41},{"id":186,"depth":85,"text":187},{"id":432,"depth":85,"text":433},{"id":675,"depth":85,"text":676},{"id":840,"depth":85,"text":841},{"id":1055,"depth":85,"text":1056},{"id":1168,"depth":85,"text":1169},"2026-10-09","Most daily Git work runs on about 20 commands — here they are in order of use, with examples.","md",{},"\u002Fen\u002Fblog\u002Fgit-commands-every-developer-should-know",{"title":5,"description":1201},"en\u002Fblog\u002Fgit-commands-every-developer-should-know",[62,1208],"guide","\u002Fblog\u002Fgit-commands-every-developer-should-know","PvSpnP7Cj3MgLejGn28cYmBJKSVxzYbXhRcdX2nQisY",1792353223623]