I find git to be incredibly useful, and this is a quick example of one of the ways that this matters to me.
This post is also available in video format here: https://youtu.be/Drwt6nseeJM
I got this link from Jes Pomfret for a Jupyter notebook she’d built: https://github.com/jpomfret/demos/blob/master/Notebooks/dbatoolsMorningChecklist.ipynb
I see this on GitHub, but this isn’t easy to download, though this could have just been a file share.
However, since it’s on Github, I can easily get this as a copy of code that stays updated. To do this, I’ll copy, or “clone” the code to my machine.
First, I go to the root of the repository, which is really a folder of code. This is the “demos” repo in this case (https://github.com/jpomfret/demos)
There’s a large green button on the right, that is the Clone button. Click the clone button and copy the URL.
I’ll do this in a cmd prompt, though you could use the open in GitHub desktop, or any git client. I prefer the cmdline, because this is really how I learn and get used to doing automation. GUI tools make this easy, but the cmdline is what I want to remain familiar with for DevOps. I can clone this with easy code:
git clone https://github.com/jpomfret/demos.git
You can see the results here.
I have all this code now on my machine. I can open this notebook in Azure Data Studio (ADS). Here I’ve picked “Open File” in ADS and browsed to the folder.
And I see the notebook.
If I don’t like this, or want to get rid of it, I delete the folder.
rmdir demos /s
And the code is gone.
There’s more to this, because I can keep the code up to date with Jes’ changes or even copy the code to my own workspace on Github and keep it up to date there with my machines, or share with others.
There’s a lot of power to Git, and you can easily get started by doing what I did here and testing Jes’ notebook. Install git today and try this out for yourself.