Home
%3CLINGO-SUB%20id%3D%22lingo-sub-286891%22%20slang%3D%22en-US%22%3ESix%20Git%20Commands%20Beginners%20NEED%20To%20Know%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-286891%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20let%20me%20say%20that%20there%20are%20WAY%20more%20than%206%20git%20commands%20you%20should%20know%20if%20you%E2%80%99re%20working%20with%20a%20project%20that%20uses%20git.%20The%20following%20video%20provides%20a%20little%20more%20instruction%20on%20Git%20once%20you've%20picked%20up%20the%20basics.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CIFRAME%20width%3D%22640%22%20height%3D%22360%22%20src%3D%22https%3A%2F%2Fchannel9.msdn.com%2FShows%2FVisual-Studio-Toolbox%2FGit-Fundamentals%2Fplayer%3FWT.mc_id%3DITOPSTALK-channel9-abartolo%22%20frameborder%3D%220%22%3E%3C%2FIFRAME%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20guide%20was%20created%20to%20address%20first%20getting%20started%20and%20the%206%20git%20commands%20that%20you%20can%E2%80%99t%20get%20away%20without%20knowing.%20The%20assumption%20here%20is%20that%20you%E2%80%99re%20working%20with%20GitHub%20or%20Azure%20DevOps%20Repos%20and%20are%20creating%20your%20repos%20through%20the%20web-based%20GUI%20they%20offer%20or%20the%20repos%20are%20already%20created.%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22this-is-not-a-replacement-for-learning-git-this-is-just-a-cheat-sheet-for-beginners%22%20id%3D%22toc-hId-1703005245%22%20id%3D%22toc-hId-1731661269%22%3EThis%20is%20not%20a%20replacement%20for%20learning%20git.%20This%20is%20just%20a%20cheat%20sheet%20for%20beginners.%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%2C%20you%20need%20to%3CCODE%20class%3D%22highlighter-rouge%22%3Eclone%3C%2FCODE%3E%20the%20repo.%20This%20takes%20a%20copy%20of%20what%E2%80%99s%20in%20source%20control%20and%20puts%20it%20on%20your%20local%20system.%20Simply%20open%20the%20command%20prompt%20and%20enter%20the%20following%20to%20accomplish%20this%3A%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20clone%20https%3A%2F%2Fgithub.com%2Fthomasrayner%2Fgit-demo.git%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3CBR%20%2F%3EIf%20you%E2%80%99ve%20already%20cloned%20the%20repository%20before%2C%20you%20can%20use%20the%26nbsp%3B%20%3CCODE%20class%3D%22highlighter-rouge%22%3Epull%3C%2FCODE%3E%20command%20to%20retrieve%20new%20changes%2C%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20pull%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3CBR%20%2F%3ENext%2C%20you%20should%20probably%20be%20doing%20your%20work%20in%20a%20separate%20branch%20in%20order%20to%20avoid%20stepping%20on%20the%20toes%20of%20your%20coworkers.%20You%20need%20to%20%3CCODE%20class%3D%22highlighter-rouge%22%3Echeckout%3C%2FCODE%3E%20a%20new%20branch%20(%3CCODE%20class%3D%22highlighter-rouge%22%3E-b%3C%2FCODE%3E%20to%20create%20it).%20You%20can%20also%20use%20%3CCODE%20class%3D%22highlighter-rouge%22%3Echeckout%3C%2FCODE%3E%20to%20move%20between%20branches%20on%20your%20local%20system.%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20checkout%20-b%20new-branch%0A%0A%23%20or%20if%20you%20wanted%20to%20move%20from%20a%20branch%20you%20created%20back%20to%20the%20master%20branch%0Agit%20checkout%20master%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20you%20can%20make%20your%20changes%20without%20effecting%20your%20coworkers.%20The%20demo%20repository%20I%E2%80%99m%20using%20validates%20these%20commands%20are%20empty%2C%20so%20I%E2%80%99m%20just%20going%20to%20add%20something%20to%20a%20readme%20file%20using%20PowerShell.%20This%20is%20%3CEM%3Enot%3C%2FEM%3E%20one%20of%20the%20commands%20you%20need%20to%20learn%20and%20solely%20used%20to%20setup%20this%20demo.%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22language-powershell%20highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3E%3CSPAN%20class%3D%22s2%22%3E%22Just%20a%20little%20somethin'%20somethin'%22%3C%2FSPAN%3E%20%7C%20%3CSPAN%20class%3D%22nb%22%3EOut-File%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22s2%22%3E%22.%5Creadme.md%22%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20check%20your%20%3CCODE%20class%3D%22highlighter-rouge%22%3Estatus%3C%2FCODE%3E%20now%20(and%20at%20any%20point).%20This%20will%20even%20tell%20you%20which%20git%20commands%20you%20probably%20want%20next.%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20status%0A%0A%23%20returns%20something%20like%20this%0AOn%20branch%20new-branch%0A%0ANo%20commits%20yet%0A%0AUntracked%20files%3A%0A%20%20(use%20%22git%20add%20%3CFILE%3E...%22%20to%20include%20in%20what%20will%20be%20committed)%0A%0A%20%20%20%20%20%20%20%20readme.md%0A%0Anothing%20added%20to%20commit%20but%20untracked%20files%20present%20(use%20%22git%20add%22%20to%20track)%0A%3C%2FFILE%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3CBR%20%2F%3ENext%2C%20to%20stage%20our%20changes%2C%20we%E2%80%99ll%20use%20%3CCODE%20class%3D%22highlighter-rouge%22%3Eadd%3C%2FCODE%3E%20like%20%3CCODE%20class%3D%22highlighter-rouge%22%3Estatus%3C%2FCODE%3E%20suggested.%20Flags%20and%20parameters%20in%20git%20are%20case%20sensitive%2C%20and%20I%E2%80%99m%20using%20the%20%3CCODE%20class%3D%22highlighter-rouge%22%3E-A%3C%2FCODE%3E%20flag%20to%20stage%20all%20my%20unstaged%20changes.%3CBR%20%2F%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20add%20-A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20my%20change%20is%20staged%2C%20I%20need%20to%20%3CCODE%20class%3D%22highlighter-rouge%22%3Ecommit%3C%2FCODE%3E%20it.%20%3CCODE%20class%3D%22highlighter-rouge%22%3E-m%3C%2FCODE%3E%20is%20the%20parameter%20for%20a%20commit%20message%2C%20otherwise%20you%E2%80%99ll%20be%20prompted%20for%20one.%20These%20messages%20are%20critical%20for%20tracking%20changes%20to%20files%20and%20projects%2C%20so%20make%20them%20good.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20commit%20-m%20%22Added%20readme.md%22%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20the%20change%20is%20commited%2C%20it%E2%80%99s%20time%20to%20%3CCODE%20class%3D%22highlighter-rouge%22%3Epush%3C%2FCODE%3E%20it%20back%20to%20GitHub%20(or%20Azure%20DevOps%2C%20or%20whatever%20else%20you%E2%80%99re%20using).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Egit%20push%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou'll%20get%20the%20following%20error%20if%20you%20haven%E2%80%99t%20pushed%20since%20creating%20your%20branch.%20%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20class%3D%22highlighter-rouge%22%3E%0A%3CDIV%20class%3D%22highlight%22%3E%0A%3CPRE%20class%3D%22highlight%22%3E%3CCODE%3Efatal%3A%20The%20current%20branch%20new-branch%20has%20no%20upstream%20branch.%0ATo%20push%20the%20current%20branch%20and%20set%20the%20remote%20as%20upstream%2C%20use%0A%0A%20%20%20%20git%20push%20--set-upstream%20origin%20new-branch%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20error%20provided%2C%20Git%20very%20helpfully%20shares%20the%20command%20that%20we%20need%20to%20use%20the%20first%20time%20we%20push%20a%20new%20branch.%20You%20don%E2%80%99t%20need%20to%20do%20this%20every%20time%2C%20but%20when%20you%20perform%20a%20%3CCODE%20class%3D%22highlighter-rouge%22%3Egit%20checkout%20-b%20%3CBRANCH%20name%3D%22%22%3E%3C%2FBRANCH%3E%3C%2FCODE%3E%20then%20the%20first%20time%20you%20push%20it%20back%20to%20your%20source%20control%2C%20you%20need%20to%20include%20the%20%3CCODE%20class%3D%22highlighter-rouge%22%3E--set-upstream%20origin%20%3CBRANCH%20name%3D%22%22%3E%3C%2FBRANCH%3E%3C%2FCODE%3E%20bit.%20After%20your%20source%20control%20knows%20about%20the%20branch%2C%20you%20can%20just%20do%20the%20normal%20%3CCODE%20class%3D%22highlighter-rouge%22%3Egit%20push%3C%2FCODE%3E%20command.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20you%20can%20go%20to%20GitHub%20or%20Azure%20DevOps%20and%20make%20a%20pull%20request%20to%20get%20the%20changes%20from%20your%20branch%20pulled%20into%20master.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%E2%80%99s%20it.%20At%20the%20very%20least%2C%20you%20need%20to%20know%20%3CCODE%20class%3D%22highlighter-rouge%22%3Eclone%3C%2FCODE%3E%2C%20%3CCODE%20class%3D%22highlighter-rouge%22%3Epull%3C%2FCODE%3E%2C%20%3CCODE%20class%3D%22highlighter-rouge%22%3Echeckout%3C%2FCODE%3E%2C%20%3CCODE%20class%3D%22highlighter-rouge%22%3Estatus%3C%2FCODE%3E%2C%20%3CCODE%20class%3D%22highlighter-rouge%22%3Ecommit%3C%2FCODE%3E%20and%20%3CCODE%20class%3D%22highlighter-rouge%22%3Epush%3C%2FCODE%3E%20if%20you%E2%80%99re%20going%20to%20work%20with%20git.%20Again%2C%20this%20is%20no%20replacement%20for%20more%20thorough%20learning%20and%20practice.%20There%20are%20a%20couple%20great%20courses%20on%20Pluralsight%20(click%20the%20link%20for%20my%20courses%20at%20the%20top%20of%20the%20page%20and%20search%20for%20%E2%80%9Cgit%E2%80%9D)%20and%20other%20text-based%20resources%20available%20for%20you%20when%20you%E2%80%99re%20ready%20to%20learn%20more.%20Until%20then%2C%20try%20not%20to%20get%20into%20too%20much%20trouble!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E(%3CEM%3E%3CSTRONG%3EEditors%20Note%3A%3C%2FSTRONG%3E%20Thomas%20Rayner%20was%20a%20major%20PowerShell%20tutorial%20provider%20for%20CANITPRO.NET%20as%20a%20Microsoft%20MVP.%20Our%20team%20is%20excited%20that%20Thomas%20has%20agreed%20to%20continue%20to%20share%20his%20knowledge%20on%20ITOpsTalk.com.%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-286891%22%20slang%3D%22en-US%22%3E%3CP%3EThomas%20Rayner%20creates%20a%20Git%3CSPAN%3E%20cheat%20sheet%20for%20beginners.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F60233i66BC6E46C8332B10%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Beginner_Git_Commands_Teaser.png%22%20title%3D%22Beginner_Git_Commands_Teaser.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-286891%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-294165%22%20slang%3D%22en-US%22%3ERe%3A%20Six%20Git%20Commands%20Beginners%20NEED%20To%20Know%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-294165%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248403%22%20target%3D%22_blank%22%3E%40Im_PJ%3C%2FA%3E%20I'd%20suggest%20checking%20out%20some%20Git%20primers%20like%20this%20one%20%3CA%20href%3D%22https%3A%2F%2Fgit-scm.com%2Fbook%2Fen%2Fv2%2FGetting-Started-Git-Basics%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgit-scm.com%2Fbook%2Fen%2Fv2%2FGetting-Started-Git-Basics%3C%2FA%3E%20that%20can%20thoroughly%20explain%20the%20different%20places%20code%20lives%20in%20Git%2C%20and%20how%20the%20workflow%20actually%20works.%20This%20is%20just%20a%20cheatsheet%20for%20folks%20who%20need%20a%20reference%2C%20or%20just%20need%20to%20be%20told%20which%20commands%20to%20run.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-293806%22%20slang%3D%22en-US%22%3ERe%3A%20Six%20Git%20Commands%20Beginners%20NEED%20To%20Know%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-293806%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F248403%22%20target%3D%22_blank%22%3E%40Im_PJ%3C%2FA%3E%3C%2FP%3E%3CP%3EStaging%20your%20changes%20allows%20you%20to%20doublecheck%20your%20changes%2C%20before%20you%20push%20them%20to%20the%20branch%20you're%20currently%20working%20on.%20Also%20if%20you%20add%20debug%20code%2C%20and%20fix%20a%20bug%2C%20but%20do%20not%20want%20to%20commit%20that%20debug%20code.%20Then%20you%20can%20select%20what%20staged%20changes%20you%20want%20to%20push.%20Try%20reading%20%5Bgit%20help%20COMMAND%5D%20e.g.%20%5Bgit%20help%20push%5D%20sometime.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHave%20fun%20coding!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-293773%22%20slang%3D%22en-US%22%3ERe%3A%20Six%20Git%20Commands%20Beginners%20NEED%20To%20Know%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-293773%22%20slang%3D%22en-US%22%3E%3CP%3Ewhat%20is%20the%20idea%20behind%20using%20stage%20command.%20Can%20we%20directly%20do%20commit%3F%20Pls%20explain.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

First let me say that there are WAY more than 6 git commands you should know if you’re working with a project that uses git. The following video provides a little more instruction on Git once you've picked up the basics.

 

 

This guide was created to address first getting started and the 6 git commands that you can’t get away without knowing. The assumption here is that you’re working with GitHub or Azure DevOps Repos and are creating your repos through the web-based GUI they offer or the repos are already created.
 

This is not a replacement for learning git. This is just a cheat sheet for beginners.

 

First, you need to clone the repo. This takes a copy of what’s in source control and puts it on your local system. Simply open the command prompt and enter the following to accomplish this:
 

git clone https://github.com/thomasrayner/git-demo.git

 
If you’ve already cloned the repository before, you can use the  pull command to retrieve new changes,
 

git pull

 
Next, you should probably be doing your work in a separate branch in order to avoid stepping on the toes of your coworkers. You need to checkout a new branch (-b to create it). You can also use checkout to move between branches on your local system.
 

git checkout -b new-branch

# or if you wanted to move from a branch you created back to the master branch
git checkout master

 

Now you can make your changes without effecting your coworkers. The demo repository I’m using validates these commands are empty, so I’m just going to add something to a readme file using PowerShell. This is not one of the commands you need to learn and solely used to setup this demo.
 

"Just a little somethin' somethin'" | Out-File ".\readme.md"

 

You can check your status now (and at any point). This will even tell you which git commands you probably want next.
 

git status

# returns something like this
On branch new-branch

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        readme.md

nothing added to commit but untracked files present (use "git add" to track)

 
Next, to stage our changes, we’ll use add like status suggested. Flags and parameters in git are case sensitive, and I’m using the -A flag to stage all my unstaged changes.
 

git add -A

 

Once my change is staged, I need to commit it. -m is the parameter for a commit message, otherwise you’ll be prompted for one. These messages are critical for tracking changes to files and projects, so make them good.

 

git commit -m "Added readme.md"

 

Once the change is commited, it’s time to push it back to GitHub (or Azure DevOps, or whatever else you’re using).

 

git push

 

You'll get the following error if you haven’t pushed since creating your branch.  

 

fatal: The current branch new-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin new-branch

 

In the error provided, Git very helpfully shares the command that we need to use the first time we push a new branch. You don’t need to do this every time, but when you perform a git checkout -b <branch name> then the first time you push it back to your source control, you need to include the --set-upstream origin <branch name> bit. After your source control knows about the branch, you can just do the normal git push command.

 

Now, you can go to GitHub or Azure DevOps and make a pull request to get the changes from your branch pulled into master.

 

That’s it. At the very least, you need to know clone, pull, checkout, status, commit and push if you’re going to work with git. Again, this is no replacement for more thorough learning and practice. There are a couple great courses on Pluralsight (click the link for my courses at the top of the page and search for “git”) and other text-based resources available for you when you’re ready to learn more. Until then, try not to get into too much trouble!

 

(Editors Note: Thomas Rayner was a major PowerShell tutorial provider for CANITPRO.NET as a Microsoft MVP. Our team is excited that Thomas has agreed to continue to share his knowledge on ITOpsTalk.com. 

3 Comments
Occasional Visitor

what is the idea behind using stage command. Can we directly do commit? Pls explain.

Deleted
Not applicable

@Im_PJ

Staging your changes allows you to doublecheck your changes, before you push them to the branch you're currently working on. Also if you add debug code, and fix a bug, but do not want to commit that debug code. Then you can select what staged changes you want to push. Try reading [git help COMMAND] e.g. [git help push] sometime.

 

Have fun coding!

Microsoft

@Im_PJ I'd suggest checking out some Git primers like this one https://git-scm.com/book/en/v2/Getting-Started-Git-Basics that can thoroughly explain the different places code lives in Git, and how the workflow actually works. This is just a cheatsheet for folks who need a reference, or just need to be told which commands to run.