[UWP] Get all the latest sample code at ease
English version available at: https://tuanmsp.wordpress.com/2015/10/23/uwp-get-all-the-latest-sample-code-at-ease/
Back in the day, if you wanted sample code for some feature, the process was Google Search > MSDN Page > download that sample code > unzip it > open the solution file to look at it.
Today things are different — Microsoft is awesome again. All the Sample code you need for Windows 10 programming is now on GitHub, and it is UPDATED daily. So you always have the newest code, written by the very engineers who built that feature.
Solid, right? Here is how to get the code.
1. A really good Git Source Control software
Since all the code lives on GitHub, you’ll need good Source Control software to:
- Download all the code
- Update the code with 1 click
- See the code versions and each version’s name
If you decide not to use Source Control software, you can still download all the code as a .zip file, extract it and use it the old way.
So which one is good?
Of course it’s your choice. Use whatever you’re familiar with. Don’t let me tell you what to do. But if you insisted, here they are
Of course it’s your choice. Use whatever feels familiar. But if you still want to know a good one (in my opinion), read on.
1.1. GitHub Desktop – Not that good
Link: https://desktop.github.com/

GitHub Desktop, developed by the octocat family at GitHub themselves, isn’t good at all. Why? Because it is too simple, and missing many basic buttons like Pull, Push, Fetch, Sync, blah blah blah.
GitHub Desktop wants everything as simple as possible. But they threw away all the familiar Git words.
1.2. SourceTree – More complex, have all the functions
My favorite: https://www.sourcetreeapp.com/

SourceTree, developed by Atlassian, is a pretty good git source control app (personal opinion). You can do everything you want with it. It even has a Command Line for those who like typing commands like a hacker.
2. Setting up
By now you may have heard the rumor that Microsoft open sourced .NET. As it turns out the rumor isn’t wrong — it’s just incomplete. Not only .NET, but quite a few other things got “opened” too. Like I said, Microsoft is playing generously again.
You can find quite a few nice things at this link: https://github.com/Microsoft
To set it up you need a “clone link”, which is one of the 3 below. Pick HTTPS to keep it simple
HTTPS: https://github.com/Microsoft/Windows-universal-samples.git
SSH: git@github.com:Microsoft/Windows-universal-samples.git
Subversion: https://github.com/Microsoft/Windows-universal-samples
Open SourceTree (or the app you like) > Clone/New

Copy / Paste the HTTPS link into “Source Path / URL”, and SourceTree fills in the other fields automatically. If you want to customize something, feel free to poke in and change it.

Finally, click Clone. That’s it — all the Sample code is now on your computer.
3. Keep the code up-to-date
Now that you have the code, what next?
To update the code, simply open SourceTree and hit Fetch > Pull, or just hit Sync from the start.
In SourceTree, click Fetch

Do you see the little red number peeking out above the Pull button? That is the number of new versions (commits) already on GitHub’s server but not yet on your machine. Hit Pull to drag them down.
And you have new code again
Tips: you can hit Pull to Fetch and Pull in one go.
Happy code reading :3