Blog Post

The Power of Git–Getting Code

,

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.

2020-03-25 10_47_31-Window

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)

2020-03-25 10_48_20-Window

There’s a large green button on the right, that is the Clone button. Click the clone button and copy the URL.

2020-03-25 10_48_41-Window

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.

2020-03-25 10_49_57-Window

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.

2020-03-25 10_50_39-Window

And I see the notebook.

2020-03-25 10_50_45-Window

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.

2020-03-25 10_51_35-Window

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.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

5 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (2)

You rated this post out of 5. Change rating