lazy git gives you a really nice simple and easy to ous interface that you can learn quickly and can make your life a lot easier when working with Git on the terminal it also integrates really well with neovim which is something that I was especially looking for in this video I'm going to show you guys how to get started with lazy git how you should approach using it and how I've integrated it into my own workflow so you can start using it too I've been using it for a couple of months now and I think this tool is really amazing with that said let's get started all right so to get started with lazy Git You need to install it first if you're on a Mac like me you can use home brew you can do something like Brew install lazy git but actually instead of this it's recommended you do the following instead to get the version that receives the most frequent updates if you're on a Linux or a Windows machine I recommend you take a look at the official lazy git repository and take a look at the installation instructions for your system after you're done installing it you can do lazy git D- version to check if everything looks good now as you can see here I've navigated to a repository this is my spell kit blog which I use to make blog posts for the channel and I'm currently on the main branch once you've navigated to a repository you can do lazy get and press enter and that'll open it up the lazy git UI will allow you to see a lot of useful information about your repository and it provides a lot of really useful ways to interact with it now as you can see here we have a couple of different panes on the left hand side that each have their own number each of these panes show something different and have a different purpose and you can navigate through them by either typing that number or using the tab key if I use tab I'll go forwards and if I use shift tab you'll go backwards if I want to go directly to the commits pane for example then I can press four and if I want to go back to files I'll press two now each pane has several different tabs to navigate through these you can use closing bracket to go forwards and opening bracket to go backwards now I'm going to exit lazy git with contrl c and I'm going to open this project with neovim to make a change I'm going to do NM and press enter I'm going to look for a layout. spelt file and I'm just going to add a console.log here it says hello there and save I'm going to close neovim with colon q and enter and open up lazy get again now you'll see that this layout. spell file has a modification that's why it has an M next to it within a pane here you can navigate with your down and up arrows or J and K just like in Vim or neov on the right hand side we can see the modification that we made to the file if you want to scroll through this main panel that chose the modification you can do page down and page up on your keyboard you can also scroll with your mouse now let's say I want to Stage this change if you ever want to see the available key maps you can use use you can use the question mark and this will show you all of the different key bindings for the Paine you're currently in if you want to filter through these you can use the forward slash like in Vim or neovim and I want to Stage so I'm going to look for stage nice so you can see here we need to use the space key if you want to exit this search mode you can press escape and I'm going to do escape again to close this window so as you saw we can press space and Stage our change if you want to unstage it you can press space again I'm going to do contrl c to close lazy git again open up neovim and I'm going to look for a different file I'm going to look for page. spelt and add another console.log here hi and comment out one of these tags again I'm going to save this close neovim and open lazy git and you can see now that we have two different files that have been changed again I'm navigating through the with j and k now let's say that instead of wanting to Stage a single file by pressing space you want to Stage all of the changes again we can do question mark and down here you'll see that with the a key we can stage all I'm going to press a and that'll stage all of my changes if I do a again then it'll undo that now let's say you want to Stage a specific hunk or change you made when you're over a file you can press enter and that'll open up this split view where you can see the currently unstaged changes on the left and the Stag changes on the right now in this view I can go to the specific line we want to stage and press space and space again and if you want to undo that you can press tab to go to the right hand side and press space to unstage and space again now to get out of this you can do Escape now once you've staged some changes let's do a to Stage all you can press C to create a commit I'm just going to type here an example commit if you want to add a description you can press tab a description for my example commit and then press tab again to go back to the commit summary and then you can press enter to commit those changes now if you go to the commits pane by pressing four you can see the commit we just made and again we can scroll through the contents of this main panel with page down and page up now let's say you want to push these changes to your remote again I'm going to do question mark forward slash and look for push so as you can see here you can use capital P to push I used Escape to get out of that and now I can press capital P and that'll push my changes to the remote main branch pane three here that shows my branches the one with the star is the one you're currently in if you want to switch to a different branch let's say I want to go to this video courses Branch I can use use J to go down or your down arrow and press space I'm going to go back to main with j and space now let's say you want to create a new Branch then let's do question mark for Slash and look for branch and as you can see here we can use n to create a new Branch I'm going to do escape and escape again press n I'm just going to call this example feature branch and press enter and that'll create it and move me into to that Branch as well and I'm going to exit with contrl C open neovim again and I'm going to change this console.log to hello from example feature Branch I'm going to save exit neovim open up lazy get I'm going to do a to Stage all press C to create a commit for my changes and I'm going to call this example feature Branch commit now I want to show you guys how to resolve a merge conflict so I'm going to press three go down to main press space to change into it close lazy git with contrl C open up neovim and I'm going to change this to hello from main branch and this is the same line that we modified in our example feature Branch I'm going to save this close neovim open lazy get again press a to Stage all press C to create a new commit I'm going to call this example commit from Main Branch now I'm going to go to paint three do question mark forward slash and look for merge and as you can see here we can use capital M to do a merge I want to merge my example feature Branch so I'm going to go down to example feature branch and press shift M and enter and as you can see here we have a conflict we can view conflicts by pressing enter I'm going to go down down here to page dos felt which is where we have the conflict press enter now if I do question mark you can see here that we can use space to select the current hunk B to pick all hunks use up and down to go through the hunks and left and right to go through the different conflicts so I can do up and down here to go through the different options these are the different hunks you can use B to select all of them I want Hello from example feature Branch so I'm going to go down to it here again you can do this with j and k or down and up arrows and if I want to select this one I can do space now as you can see here it says all merge conflicts resolved you can press enter to continue and we're done we've resolved the merge conflict and successfully merged our feature Branch with the main branch now another convenient thing I want to mention is that whenever you're in a panel here let's say you're in number three and you want to look for a specific Branch again you can use the for SL Dash to filter through it say I want to look for example and it'll filter the branches to the example feature Branch if you want to exit this mode you can press escape and also you can press enter to see more information on whatever you're hovering so if I'm over this example feature Branch I can press enter to see all of the commits within that branch and you can go back with Escape if I'm over here in the commits pain four and I go down here to one of the commits and press enter I can navigate through the specific files of that commit and press escape to go back now there's a lot more stuff that you can do with lazy git the repository has a lot of different examples on more of the advanced features I just wanted to give you guys a general overview on how it works how to get started with it and show you guys how straightforward it is to reason through the best way to find out how to do what you need to do is to just start using it and make use of the question mark and the filtering feature with forward slash to look for the specific action you want to take before I finish though I want to show you guys how to easily integrate lazy git with neovim which is the workflow that I use and it's been really amazing for me I'm going to close lazy get with contrl c and I'm going to navigate to my home directory sl. config envm and press enter and open up neovim to open up my neovim configuration open the file explorer go down here to Lua hosan plugin and you'll see here that I have a file for lazy get I'm going to open this up this is all you need over here I have the short plug-in URL for lazy get all of these commands will lazy load the plugin it has plenary as a dependency and I've registered this key map so that I can use space LG to open up lazy git within neovim if I close neovim and I go back to my spelt kit blog and open open up neovim now I can use space LG and that will open up lazy git within neovim which is really convenient to close lazy git within neovim you can press Q or you can do contrl c now it'll have all of the same functionality as before but I don't have to switch between lazy git and neovim all the time all right you guys that's it for this video I hope you enjoyed it and found it interesting and helpful if you did don't forget to leave a like down below let me know in the comments comment section if you have any questions or feedback for me and don't forget to subscribe to the channel to see more content like this from me see you guys in the next one peace [Music]