Month: January 2017

How to view the diff of a markdown (.md) file as its rendered content – 031

When you’re viewing changes to a markdown file, you have the option to compare the rendered versions in the diff view.

Let’s say you wanted to view the diff of my latest commit to my README.md in my random-example repo. By default you are looking at the raw markdown contents, i.e. the “source diff.”

viewing latest diff of readme as source

But suppose you wanted to view the actual rendered markdown file as a diff. Click on the Display the Rich Diff button located in the upper right.

Display the rich diff button in upper right

Now you’ll see the diff of the README.md file as a rendered file.

display the diff of README.md as a rendered file

How to view the latest commit made within a particular folder on GitHub – 030

Something I had a hard time grasping early on using GitHub was why the latest commit would keep change. Obviously, at the root level (homepage level), the Latest commit is showing the latest commit for the entire repo, but why does it keep changing after that?

The latest commit is showing you the commit for the last time any files at this folder level were modified. Let’s look at my simple random-example.

When you go to the main repo page, you’ll see the Latest commit c8cac61 3 days ago (at the time of this writing) is the last commit to the repo.

main repo page - Latest commit c8cac61 3 days ago

But then if you click inside the Randomness folder, you’ll see the latest commit changes to Latest commit 567c29d 6 days ago.

Randomness folder showing commit 567c29d 6 days ago

And if you continue to drill down into these folders, you’ll see that the latest commit continues to change to c59c490 6 days ago.

Latest commit c59c490 6 days ago

What is with all these changes?

The latest commit is showing you the commit for the last time any files at this folder level were modified.

Again, I’m a visual learner (as you’ve noticed by now), so here’s an example. In the image below, you are looking at the C# Project folder called Randomness with Latest commit 567c29d 6 days ago. Notice how there are multiple files.

Randomness folder showing Latest commit 567c29d 6 days ago

Clicking the Latest commit 567c29d 6 days ago shows the actual file(s) that were modified as part of that commit, which in this case was just one file.

commit 567c29d showing only 1 file Class1.cs modified

How to view the last changes (commit) made to a file in a repo on GitHub – 029

Suppose you want to see the last commit made to a particular file because you want to know what changed. Using my Masters UX project TheoryC as an example (it’s a Kinect app to do experiments in Kinesiology where you follow a ball around in a circle), let’s say you want to see the last changes made to the ViewModel.

If you click on the ViewModels folder, you’ll see the MainViewModel.cs listed.

MainViewModel.cs shown listed in the ViewModels folder

Now in the upper right, you can click on the commit ID shown, which is the last commit ID for the given file.

clicking on the last commit ID in the far right

Clicking on this last commit shows the changes for that given commit.

Showing commit changes for Made Other/Debug Settings Window movable

P.S. Now you’re probably wondering, “Why on Earth would you need to modify your DataLogger or even your MainViewModel to make your DebugWindow moveable?” Yeah, great question. I have the hardest time saving just one functional unit of change per commit. Learning good commit practices is hard when you’re working alone, because it’s easier to let this stuff slide.

P.P.S. Since starting this series, I’ve learned through my research that you can actually add only certain files, one git add at a time, and commit just those! This solves my above dilemma. Stay tuned in mid-late February  for how to do this!

How to view a diff for a commit as files side by side on GitHub – 028

Personally, I’m not a fan of the inline diffs that make you do homework to figure out what’s being added and what’s being removed.

For example, if you go to the Code – Commits page and click on the commit id for a given commit, as shown in the illustration below,

Code - Commits page clicking on a commit id

You’re taken to a page that shows the diffs as inline or unified for the file.

diff of readme.md that's shown unified

Fortunately, there’s a split button in the upper right hand corner that says Unified | Split.

Clicking on Split portion of the button will show the before and after changes side by side, which is just my personal preference.

diff showing changes before and after side by side