Professional Documents
Culture Documents
Tutorial GitHub
Tutorial GitHub
GitHub Graphs
We're going to check out our network and branching graph on GitHub, and on the local system.
Let's start out on the local system.
Let's go back to our terminal, and I'm currently in the "website" Git repository, on the master
branch, and I'm currently in a clean working directory state.
Now that we've done lots of commits and some branching and merging, we should start to see
some level of branching off and merging back when we do our graph.
If I do a "git log --oneline --graph", the "--graph" option is what will denote the graph of our
branches as they come and go.
So, you can see some earlier commits were on other branches and they were eventually merged
back into master.
Some of the branches noted came from GitHub, and some were local.
I'm going to press 'q' to quit out of that, To give some more context, I'm going to use my "hist"
alias, which is equivalent to the "git log" command with several other options.
Doing that will actually show us the branches that are involved with each of the commits.
And, right now, everything is up-to-date at the top most commit.
So, both master and 'origin/master' are pointing to our latest commit.
And, we can scroll back into our commit history, and scroll back up as well.
Press 'q' to quit. We can see a similar type graph on the GitHub interface too.
Let's switch back over to GitHub.
I'm currently logged into GitHub, on the website GitHub repository.
Over on the right hand side, we have our repository menu.
One of the options is "Graphs", so click on "Graphs".
Within graphs, we have "Network", click on "Network".
Network will kind of give us a graphical representation of the different branches, and even other
people that have been forking off of our repository.
We'll cover that later, but for now, it just shows us our own branches and merging back in.
Tags on GitHub
Great, now that we have our tags up on GitHub, let's get more familiar with the way that tags are
displayed on GitHub.
As I mentioned before, on this listing of tags, we have both annotated and lightweight tags listed.
For the lightweight tags, we just have the commit message associated with that tag.
And, for annotated tags, we have the corresponding tag message.
We also have the commit id that they're associated with, along with a zip file or tarball of the
source code from that version of our repository at that point in time.
We also have a reverse timeline, starting with the most recent and working our way backwards.
If you click on the tag name within GitHub, it takes you to a specific page about that tag; in this
case it shows that I tagged it 17 minutes ago, and that develop has had 14 commits since this tag.
It also shows me the message for the tag, and the downloads, which are the corresponding zip
and tarball.
If I click on "14 commits", it takes me to a diff comparing the tag that I clicked on and the
develop branch.
And, if I want, I can click on the specific commit id, which takes me to a page that has
information specifically about this commit.
And, on this commit page, you can see that we have our tag associated with this commit, as well
as being on the develop branch.
I'm going to click on tags to get back to our listing of tags.
Click on the name of the repository, and that will return us to the main page for this repository.
One thing I like to point out is that our branch dropdown, if we click it to expand, we now have
the option between branches and tags.
If I click on the tab for tags, I see a listing of all our tags that we have associated with this
GitHub repository.
I also have the option to find a tag if I had a really long list.
To see this repository as of a specific tag, just select a tag.
For example, I will select "v0.2-alpha".
Now, we are viewing this repository as of that particular tag.
At any point, I could switch to another tag, or to one of the branches.
I'm going to return back to that tag.
As I click around, I'm still viewing this repository as of this tag.
At any point, I could change the tag or the branch.
Deleting a Release
We're going to look at the release page and also then delete our release. I'm currently logged into
GitHub, and on the website GitHub repository.
Specifically, I'm within Releases.
We just created a "Release 0.3 BETA".
If I click on the title, it takes me to a release page about this release specifically.
And, similar to the tags page, it lists the name of the release, the tag associated, the commit id
associated, whether or not this is a full release or pre-release, and other information about this
release.
I have the option to edit this release, which we've covered before, and I also have the option to
delete this release.
One thing to keep in mind is, if you delete a release it doesn't mean you delete the underlying tag
associated with it.
Let's try that out, click on the "Delete" button.
GitHub will warn you, "Are you sure you want to delete this release?"
Click on the "Delete this release" button.
Great, so now we're back, but we still have this listed under releases.
And that's because, by default, the releases tab will simply list out all the tags in GitHub, which
is not that much different than the tags tab.
In order to fully get rid of both the release notes and the tag, we still need to come in and then
click on the tag to go the tag page, and then click on "Delete" here as well.
Once you're happy, click on "Delete this tag".
Great, now refresh your page; now we're left with just two tags, stable and unstable.
Comparing Tags
We're going to quickly compare tags in GitHub.
I'm currently logged into GitHub, and on the "website" GitHub repository.
Let's click on releases, then go to tags.
We have three tags; we have "stable", "v1.0", and "unstable".
Let's remember those three tags.
Now, let's go to the far right hand side and click on the icon for pull requests, then click on "New
pull request".
When we land on the compare changes page by default it wants to compare branches together,
since this is the workflow by which we generally start our pull request mechanism; however, we
use this page for doing comparisons as well.
On the base, we're going to stick with master, and at this point, we are comparing master to
develop.
Let's expand out develop, and now we have an ability to specify a tag, commit, branch, or history
marker.
Let's use the tag "unstable".
Once GitHub finds a match, click on "unstable".
Now, we're comparing the unstable tag to the branch named master.
By the same token, we can change the base; expand it out, and instead of master, we're going to
type "1.0", then click on the item or press enter.
So now base has changed to 1.0, and we're comparing that against the unstable tag.
So, at this point, we are comparing two different tags.
Advanced Comparing Even More Fun
We're going to do a little bit more advanced comparisons in GitHub.
I'm currently logged into GitHub, and I'm on the "website" GitHub repository.
Go over to the right hand side and click on "Pull requests", then click on new "pull request".
That will take us to the compare changes page, and by default, it's going to want you to compare
two branches together; however, if you scroll down, you'll notice that there's some advice on
other ways that you can do comparisons: branches, tags, commit ranges, and also time ranges.
For example, we could compare the head of develop against three days ago on develop.
Let's expand out our base dropdown, and then type an expression that will compare our develop
branch from three days ago: "develop"; and then the "@" symbol; then, in curly braces, a date
range "", then press enter.
This gives us a comparison, comparing the head of develop against develop from three days ago.
We can scroll down, and we can see the files that are associated with this comparison.
We can get even more specific; let's change this compare to a tag named "unstable".
Now we're comparing develop at three days ago to unstable.
Now let's change this to master at a specific date: "master"; the "@" symbol; then, in curly
braces, the specific date in the year-month-day format, "2015-28-05", that would be august 25th
of 2015, then press enter.
Now we're comparing master at that specific date against the unstable tag.
Again, we can look down and see all the changes that were made.
In addition to using date ranges, we can use commit ranges, including relative position to HEAD.
Let's change compare back to "develop", and let's change the base to "HEAD", which HEAD
typically points to the last commit on the current branch; then the "@" symbol; and then, in curly
brace, the number 3: "HEAD@".
Press enter, now we're comparing the current develop branch, that is the HEAD position at
develop branch, against the HEAD position at 3.
Let's do one more example; let's change our base to a tag, in this case we're using the "stable"
tag, against HEAD - 1 (HEAD^).
Press enter, and now we have our comparison from the stable tag versus HEAD - 1.
Scroll down, and you can see the differences involved.
Copying A GitHub Repository by Forking
We're going to start off our social coding by forking an existing repository.
I'm currently logged into GitHub, and I'm on the "website" repository.
To show you where I'm going, I have another browser that's currently on the "starter-web" of the
"scm-ninja" organization in GitHub.
This is the repository that we are going to fork and make available on our personal space on
GitHub.
So, now I'm going to return to my main browser, and to set our bearings I'm going to click on my
username and that takes me to my newsfeed page.
And, I currently only have two repositories, which is my demo and my website.
Now, while logged in, I'm going to go to the "scm-ninja" username, so the URL would be
"github.com/scm-ninja", press enter.
Now find the starter-web repository; click on the name of the repository.
And now, at this point, we are not associated with this repository in any way, nor are we a part of
this organization; however, since this repository is a public repository, we can fork this
repository and make contributions, and later on submit pull requests to potentially have those
contributions accepted into this repository.
Let's start off by making a copy of this repository into our personal space by using the forking
mechanism.
Go over to the top right-hand side, and click on the fork button.
This will automatically make a copy of this repository into your personal space.
Once you land back on your personal space on GitHub, which you know by having your
username here at the top, and then you should have "starter-web", which is this repository, and
immediately underneath that you should have text that says "forked from", and the "scm-
ninja/starter-web" repository.
If we click on that link, that takes us back to the repository from which we forked.
From this point forward, I'm going to refer to this repository as my upstream repository or our
parent repository, since this is where we forked from.
I'm going to use my browser’s back button, and that will return me back to my copy of the
"starter-web" repository.
Creating. Branch on Your Fork
We're going to clone our newly forked repository to our local system and then create a feature
branch, make some changes, which will then set us up for a pull request later on.
I'm currently in the "starter-web" repository, on my user's space, in my account in GitHub.
Let's scroll down and find the cloning options for this repository.
I'm going to leave it on SSH, and I'm going to click on the "Copy to clipboard" button.
That will copy this URL to my clipboard. So now, I'm going to go to my terminal, and I'm going
to make sure I'm in the "projects" folder.
Type "git clone"; space; and then paste in the URL that should be in your clipboard.
Review, and then press enter. Great, now we should have a "starter-web" folder within the
projects folder.
Go into "starter-web", and we should be on the master branch.
Let's create a feature branch on which to do our work: "git checkout -b" to create the branch;
space; and then the name of the branch, in this case I'm going to use "feature-readme"; press
enter.
We have created the feature branch and switched into it at the same time.
Let's do an "ls -l", and that will list all the files that are available in this repository; however,
there is something that is missing, and that is a Readme file.
So, let's create one: type "mate"; space; and then I like to use all caps for "README", then
".md" in lowercase: this signifies this is a Markdown format file.
I'm going to add some content to my Readme file, then save and then close.
Once you've returned to your terminal, we're going to add the Readme file to the Git index: "git
add README.md".
We currently have our new readme file in the Git staging area, so now let's commit: "git commit
-m "Adding README file".
Great, now we're back to a clean working directory on our feature branch.
Alright, now let's push this feature branch up to GitHub: "git push -u" to set up the tracking
relationship; "origin" which is the name of our remote repository; space; and then our branch
name, "feature-readme".
Double check the line, and then press enter.
If all went well, you should have a screen that looks like this.
In particular at the bottom we should see that we created a new branch, mapping "feature-
readme" to "feature-readme" on the remote side.
Let's go check it out on GitHub; back in my browser, I'm on the starter-web repository.
If I do a reload, you can see that GitHub has already detected a newly added branch: "feature-
readme".
And, in a minute, we will do the compare, but I also want to show you that the "feature-readme"
branch is also available in the dropdown of branches.
Pull Requests
We're going to check out our newly created feature branch and then submit a pull request to
contribute our changes to our upstream repository.
First, let's check out the newly created branch; if I click on "feature-readme" or select it from the
dropdown, I'm now on the "feature-readme" branch in my GitHub repository.
If I scroll down just a little bit, I can see that we have the "README.md" file.
The "README.md" file is a special file within GitHub; if GitHub detects it, it will display it at
the bottom of the repository listing.
Now that we've confirmed that those changes have made it up to GitHub on that feature branch,
let's proceed forward by submitting these contributions to our upstream fork repository.
To start that process, I can click on the "Compare & pull request" button, or within the listing of
the repository I can click on "pull request" when I'm on that corresponding branch.
I'm going to click on the "Compare & pull request" button to proceed.
By default, the pull request is going to set up the relationship back to the upstream repository.
This happens when your repository is part of a fork, which it is.
I have my main fork, which is my upstream or parent repository on "scm-ninja", and I have my
fork, which is in my user space on GitHub.
I want to make sure that I'm comparing my feature branch to the branch that I need to target in
my parent repository, in this case master.
Once I'm satisfied with this relationship, I can scroll down and click on "Create pull request".
Excellent, once you've landed on this page, you have successfully created a pull request.
And what you'll also notice is that you'll land on the target repository when this pull request is
created.
And that's an important distinction, because what a pull request is is the request from the
upstream repository to pull in your changes.
GitHub Graphs
Welcome, in this video, we're going to look at the pulse and graphs section of GitHub.
Instead of showing those features with the main login that we've been using throughout the
course, I'm going to return to the "starter-web" under "scm-ninja", logged in with a different
account.
And, that's because that I have more data in this repository than I have with the repositories that
we've been using throughout this course.
So first let's check on "pulse", which is on the right hand side menu of our repository: click on
pulse.
The pulse will give us trends over time for our repository.
We can change the time period to show last 3 days, 24 hours, 1 week, or the past month.
And, this just gives us overall statistics about our repository, including merged pull requests;
proposed pull requests, which are pull requests that are open; closed and new issues, which we
will be covering in an upcoming section of this course; and then some general statistics about the
number authors involved, the number of commits, and how many additions and deletions were
involved across the board.
From here, we go over to the right hand side, and we see an abbreviated version of our menu; we
have icons that represent each of the parts of our repository that we can get to using that menu:
code; issues; pull requests; wiki; pulse, which we're currently on; and then graphs.
Click on "Graphs". The first tab we come to is contributors.
Contributors are all the people that make contributions to your repository.
I can filter by commits, deletions, and additions.
Next, let's click on traffic, and we can see the overall activity on our repository, including
number of clones that are happening; the number of visitors to the GitHub repository; our
referring sites; and our most popular content within the repository, along with the views and
visitors.
Next, let's check out commits. This shows us the commits that have been happening recently to
this repository. Now, let's check out code frequency.
This gives us a graph of additions and deletions to this repository.
At this point, we haven't been doing a whole lot, so there's not much to see here.
Now, let's check out "Punch card"; the punch card shows the commits we've made by day of
week and timeframe. Next, let's check out "Network".
Network shows a lot of the branches that are involved along with a lot of the forks as well.
Now, let's move onto "Members"; Members is a great way to see a list of all the people that have
forked your repository, including the fork that we created earlier, which goes to my
"jasongtaylor" user account.
I'm going to click on the name of this repository, and I'd like to show you there are sometimes
alternate ways to get to each of those items.
So, for example, I can click on the number of forks to take me to the network page.
Synchronize Changes Back to Your Fork
We're going to synchronize our individual fork from our parent repository.
So far, what I've been referring to as the upstream or parent repository has been the repository on
"scm-ninja/starter-web".
And that's the repository from which we forked our copy of that repository, which is found in our
"jasongtaylor" account or would be found in your account if you've been following along.
We can see that by, on our newsfeed page, we have a section that it says repositories you
contribute to, and it lists "scm-ninja/starter-web", which gives us the option to go directly to that
repository, and if we wanted to, we could watch or star this repository.
Let's click star; this will send us notifications later if this repository changes for some reason.
Alright, so while we're here, let's copy this GitHub repository's URL; let's scroll down and find
the cloning options for this repository, that should be in the lower right hand side.
Change the default from HTTPS to SSH if you need to, then click on the copy to clipboard
button to copy the SSH URL to your clipboard.
Now, let's go back to our terminal. Back at the terminal, I'm in the "starter-web" repository on
my local system.
I'm currently on the feature branch we just created, in a clean working directory state.
Since I know we've merged in those changes into master in a different repository, we can change
out of this branch: "git checkout master".
Let's verify our changes on GitHub; so you'll notice that on "scm-ninja/starter-web" we have our
"README.md" file.
If I return to our version of that repository, we do not have that Readme file in the master branch.
So, how do we synchronize our upstream repository from which we forked down to our
individual copy of our repository?
Well, unfortunately there's no direct way to do that from the GitHub interface, so we must use
our local copy as an intermediate.
Let's go back to the terminal, and back on our master branch, let's go ahead and see a list of all
our remote repositories.
Type "git remote -v", "-v" is verbose, and that will show all of our remote repository references.
When we cloned this repository, we got origin set up for free; that is, when we used the "git
clone" command, Git automatically establishes a remote reference named origin back to where
we cloned from.
In this case, our "starter-web" repository on our user account on GitHub.
We do have the ability to add more remotes that refer to other Git repositories from which we
can push and pull.
To do that, we need to use the "git remote add" command; type "git remote add", then the name
of the remote reference we wish to create.
It can be anything we want, as long as it's something that we can remember.
Since I've been referring to the upstream or parent repository as upstream, I'm going to create the
remote reference as "upstream".
Now, paste in the URL that should be in your clipboard; command or control+v, then press enter.
Now when we do "git remote -v", it shows us we have two pairs of remote references: "origin"
and "upstream".
And, technically they're listed twice, because you can have different remotes for both the fetch
and the push; however, 99% of the time they should be identical.
Now I'm going to use the "git pull" command, specifying our "upstream" repository to fetch any
updates from that master branch.
Type "git pull"; space; and then our new reference, "upstream"; space; and then master for the
master branch; now press enter.
Great, now we've downloaded all the updates from the "upstream/master" repository, and in
doing so, we have our Readme file that has been added.
Now we have "README.md" file in our files that are part of the local repository, and since our
local repository has the changes that we just got from upstream, but our individual fork of the
repository on GitHub does not have that, we need to push our changes from our local repository
to our individual fork, which is currently referenced as origin; "git push origin master", now
press enter.
Great, now let's check it out on our personal fork.
Go back to our browser, and make sure that we're in our user account on the "starter-web"
repository.
Now let's refresh our browser, and if we scroll down, we should now have our "README.md"
file, and it should display at the bottom of our listing.
Super, now let's go back to our terminal, and do a little bit of cleanup.
Back on our local Git repository, if I do a "git branch -a" I show all our branches, including local
and remote branches.
I'm currently on master, which is exactly where I want to be, and it's time to delete that feature
branch.
Type "git branch -d feature-readme", and that will delete the feature branch.
Now, if you did not integrate the changes from the upstream repository onto the master branch,
then you wouldn't have the changes from the feature branch on master, and then Git would
complain when you tried to delete the feature branch.
But, since I've already integrated those changes, Git should allow me to delete the branch
without any problems. Super, the branch has been deleted.
Now, if I type "git branch -a", I see that I only have the master branch for my remote branches,
but something's curious here; I see that I have "remotes/origin/feature-readme".
That's a local references to our remote branch.
Let's check it out; I don't think we have that branch anymore.
If I go back, this is origin, so that's my user account on GitHub and the "starter-web" repository.
If I go to the branches dropdown, I only see master, which is further confirmed by the branches
tab showing only "1 branch".
If I click on it, I see that I only have master; so this repository definitely has only master.
But, on my local copy, it still shows that remote reference.
If you find yourself in this situation, you can fetch the latest updates passing in the prune option:
"git fetch -p", with the "-p" being the prune option.
Now press enter. Great, Git goes out to GitHub, notices that the "feature-readme" branch has
been deleted, which then it deletes the refine to that branch.
Setting Up Milestones
We're going to look at milestones within the GitHub issues feature.
I'm currently logged into GitHub, in my personal account, on the "website" repository.
Within that repository, I'm currently on the issues main page.
Before we create a new issue, let's look at milestones; click on the "Milestones" tab.
When you first get here, you won't have any milestones associated with this project, so let's
create one; click on the green "New milestone" button.
And milestones are just major events that you're building up to within your repository.
It could be a pending release, or some other type of checkpoint.
I'm going to create a milestone called "Beta 1"; in the title, I'm going to say "Beta 1".
In the description, I'm just going to type some descriptive text that provides a little bit more
context for this milestone.
Additionally, I could provide an optional date; I'm going to set this out to next week, then I'm
going to click "Create milestone".
Great, well I'm going to create another milestone while I'm here.
Click on "New milestone", I'm going to name this "Beta 2"; provide a description accordingly,
and set this two weeks out from where I currently am, and then I'm going to click "Create
milestone".
Great, now I have two milestones.
At any point I could delete a milestone, close the milestone, or edit the milestone.
For example, I'm going to edit Beta 2; go over to the right hand side, and click on "Edit".
I've decided that two weeks really isn't enough for the next beta, so I'm going to advance to the
next month and choose a more reasonable timeframe.
I'm going to select the 4th, then click "Save changes".
Great, I'm going to create one more for the purpose of closing it.
Go to new milestone; I'm going to create "Alpha 1", then, for the description, "This is the first
alpha for this project".
I'm going to set this date for a few weeks ago, then "Create milestone".
What you'll notice is that GitHub will let us know that we are past due by a month.
I'm going to go ahead and close this milestone; I can either do that within the edit page, or
directly on this page by clicking on "Close".
Closing the milestone will move that milestone from the open status to the closed status.
I can always access it again by clicking on the "Closed" status.
And, if I needed to, I could re-open this milestone, or I could just delete it.
I'm going to keep it around, and just return back to open.
Once you have a number of milestones listed, you also have the ability to sort, and we have
various options, including: closest due date, furthest due date, least complete, most complete,
most issues, least issues.
Since we don't have any issues yet, we're not going to bother sorting on those last two items.
Alright, I believe that's enough for now, so I'm going to return back to the main issues page.
Creating Issues
We're going to start creating issues in GitHub.
I'm currently logged into GitHub, and I'm on the "website" repository that we've been using.
I'm currently in the main issues page, which is accessible by going to "Issues".
In previous videos, we updated our labels to suit our needs for this particular project, and we
created some milestones, so now we're ready to create some issues.
Go back to issues, and on the issues main page, click on the green "New issue" button.
Once you're there, you have the ability to add a title, then write a comment related to this issue,
apply a label, milestone, and assign it to somebody.
Let's start off with the title.
The first issue I'm going to create is an enhancement: "Add getting started section to README".
In the comments, I'm going to add some Markdown, "README update", and then underneath
that, "Please add a _getting started_ section to the README, so folks know how to start with
this project".
If I flip over to preview, you'll see the markdown being applied.
Go back to write. So, I'm happy with my comment, now I'm going to head over to the right hand
side and look at labels.
I'm going to click on the sprocket, and that opens up the available labels to apply.
I'm going to select "enhancement", and while I'm here, I'm actually able to select multiple items
if I choose to. For now, enhancement is fine enough.
Once I'm happy, I'm going to use the x to close this dialogue; that updates the labels with
enhancement.
Under milestones, if I click on the sprocket the two open milestones are presented first, but I do
have access to the closed milestones as well.
I'm going to select "Beta 1"; that updates my assigned milestone.
And then, under assignee, since I'm the only one in this repository I'll just select myself.
If you had other team members helping you out, you would have a list of other team members
that are part of this repository.
Once you're happy with all the changes on this page, click on "Submit new issue".
Great, now we have created our first issue.
Once we create that issue, we actually land on the specific issue page.
You'll notice this starts with "#3", and that's because, on this repository, I created a couple pull
requests, which are also tracked as issues in GitHub.
So, my first true issue is "#3". On this page, we can see all the various aspects that are related to
a particular issue.
We see that I created the issue, and the markdown formatted message that I associated with this
issue, and the history of this issue.
And, on the right hand side, I see the label "enhancement" associated with this issue; and the
milestone "Beta 1"; and, of course, the assignee, which is myself.
If I scroll a little bit further down, at the bottom, I have the option of leaving additional
comments, and, of course, previewing that comment once I've written something here.
And then I can click on "Comment", or I can choose to close the issue.
For now, I'm going to return back to the main issues page.
On the main issues page, I have a listing of all my issues.
And, currently, I just have one, which is "#3".
From this page, I can click on the title of the issue to go to that specific issue page.
Closing Issues
I'm going to update my Readme file and then close the associated issue in GitHub.
I'm currently logged into GitHub, and I'm in the "website" repository that we've been using.
If I go to issues, I see that I have 1 issue. Click on "Issues". And we have an issue, that is an
enhancement, "Add Getting Started section To README".
Well, let's go work on that; I'm going to go back to my main page for the repository, and find my
Readme file. There it is, "README.md".
Click on the file, and for this simple example, I'm going to edit this file directly on GitHub.
Click on the "Edit this file" button, and after the purpose section, I'm going to create a "Getting
Started" section.
Alright, so let me preview my change; ok, that looks good.
Scroll down, and I'm going to commit my change: "Adding Getting Started section to
README", then click on "Commit changes" and now I'm going to return back to issues.
So now, I know I did the changes that are needed for this enhancement.
So I'm going to click on the issue, then write a comment describing what I did for this particular
issue: "Added **Getting Started** section in README file."
Let's preview it; good, "Getting Started" is bolded, which is great.
I could simply comment, but that would leave the issue open; let's instead click on "Close and
comment".
Even after the issue has been closed, you can still leave additional comments; however, for now,
I'm not going to do that.
Let's go back over to the right-hand menu, click on issues.
The default page for issues shows only open issues, which there are currently none; however, if I
click on the closed status, I see the enhancement that we just closed.
And, I can click on the title and go into that closed issue.
It denotes that it's been closed up here at the very top, and towards the bottom I see that the last
item in history is that I closed this issue.
All we have are the comments and the fact that I closed the issue, but you don't know which
commit was associated with it.
Now, I could go in and copy the commit, and reference it within my comments, but there is an
easier way, which I'll cover next.
Creating Gists
We're going to take a quick look at Gists.
I'm currently logged into GitHub, and I'm on my newsfeed page.
If you're somewhere else in GitHub, just click on the octocat icon at the top.
This will take you back to your newsfeed page.
At the top of the page, we have an item called "Gist" or "Gist", depending on how you prefer to
pronounce this.
Click on "Gist"; gists are a way of sharing little snippets of code, kind of like a Pastebin.
But it's not intended for a full file, although it can be; typically it's for one or a few files.
Using gists, it's basically a miniature Git repository.
Starting out, I don't have any gists, so I'm going to create one.
I'm going to give my gist a description; I'm going to call this: "Java Home Environment Variable
on Linux".
The file name I want to use, which would be the filename plus extension; I'm going to call this
".bashrc", and in the contents I will just type in or paste in the contents of the snippet of this file
that I wish to share with others.
I can add additional files if I need to.
For some systems, ".bashrc" file will be fine, but for others I will need to use another file:
".bash_profile".
So, this gist has two files, or really the partial of two files.
Once I'm happy with my changes, I have two options; I can create a secret gist or a public gist.
A secret gist is publically available, but excluded from search engines, so you must give out the
gist URL for people to access it.
If we create a public gist, the gist will be fully available to anyone searching on Google or other
search engines.
I'm going to create public gist.
Great, so I land on the page that is for this gist, and you can see it looks a lot like a miniature Git
repository.
For example, I can edit if I go up to the edit button; let's separate this out onto two lines.
Great, in bash I create a variable, in this case "JAVA_HOME", and set its value to
"/path/to/java", then I export the "JAVA_HOME" environment variable.
Then, I'm going to click on "Update public gist".
Great, so the code over here shows revisions; if I click on revisions, I can see a diff between the
different versions.
I'm going to click on the name of the gist to go back to its page, and at the bottom if I wish to, I
can leave a comment using the markdown format.
Once I'm happy with my comment, I'm going to preview it.
That looks good to me; click on "Comment" to leave the comment.
Sharing Gists
We're going to look at sharing our gist with other people.
I'm currently logged into GitHub; I'm on my user's account on the newsfeed page.
I'm going to click on "Gist" or "Gist" to go to the main gist page.
I have my ".bash_profile" gist from before.
If I click on "See all of your gists", I have it right here.
And I click on the name of the gist; once I do that, I'll land on the gist page.
This one actually has two files associated with it, and typically the way that we share this with
other people is simply to reference it by the URL; this URL is unique to this gist.
So, I'm going to copy it, and then include that link in emails, or forums, or anywhere else that I'm
posting, perhaps on my own website.
I could optionally use a URL shortener to make the URL a little shorter and/or provide a little bit
more user-friendly version of the URL.
For example, if I go to "bitly.com", I can paste in that URL, and then I would copy that, and
provide that in the forum or email, or any other communication with others.
Deleting Gists
We're going to look at deleting our gist.
I'm currently on the gist that's associated with my profile, and although it is a fine gist, I decide
perhaps I want to go in a different direction or I no longer want to make this gist available.
The option I have available is to delete the gist.
So, on the specific gist page, click the delete button.
GitHub will prompt me to ensure that I really want to delete this gist; I'm going to click "OK".
I get a blue banner that tells me I just successfully deleted the gist, and, in this case, I have no
other gist so I don't have anything to list.
Once I'm done here, I can click on view my profile on GitHub, and that returns me back to my
profile page on GitHub.
Once I'm here, I'm going to click on the octocat to return to my newsfeed.
Now, we're not completely done yet; we need to do a little bit of cleanup back on our local
system.
So, go back to our terminal, and I'm currently in the "my-gist" folder, which is the Git repository
for our gist, underneath the projects folder within our user's home directory.
Let's back up a level, and now delete the "my-gist" folder.
Type "rm"; space; and then us the "-rf" options; space; and then the name of the folder.
Double check that line, because the "rm -rf" command is extremely powerful.
Once you're confident that you have everything specified correctly, press enter.
Now if we type "ls -al", we no longer have the "my-gist" folder.
Team Permissions
We're going to further manage our teams.
I'm currently logged in as "jasongtaylor", but I'm on the "my-organization-example"
organization.
If I go to people, I see I currently have two people that are part of this organization: "awesomejt"
and "jasongtaylor". If I hop over to "Teams", I currently have one team called developers.
If I click on "Developers" I go to the developers team page, which allows me to manage the
settings, and who's part of this team, and any repositories that are associated with this team.
If I click on settings, I have the ability to edit the team.
I'm going to change the description to "Team for development staff".
Once I've done that, I can click on "Update".
Great, the description for the "Developers" team has changed.
Another aspect of the teams are the repositories that are associated with the teams.
Teams have two facets; the team members, and the repositories.
Let's click on "Repositories"; by default, there are no repositories associated with this team.
If we go to "Add repositories", and just start typing the name of a repository name, we should
have a listing that includes something that matches our search criteria.
Once we find the repository we wish to add to this team, we just click on it and it is added to this
team.
I also have the option to choose the visibility of this repository within this team.
By default, it's going to place it as read-only, which only allows members part of this team to
have read or view access to this repository.
If I want to, I can use the dropdown, and change the permission level.
"Read" means it allows team members to read or view the contents of the repository and to also
clone the repository, or even make a fork of this repository into their personal space on GitHub.
This is a fairly common level when working with open-source projects that you're not directly
managing.
"Write", which is the next level up, allows team members to read, clone, and push to this
repository.
It also allows developers to directly make modifications to files on the GitHub repository, and
then finally "Admin" allows team members to have admin access to the repository, which means,
in addition to reading, writing, and pushing, it allows team members to add other collaborators to
this repository.
For the development team, I want all repositories that are associated to have write access.
Once I select "Write" GitHub automatically updates that permission.
Great, I'm going to click on the name of my organization, and that will just take me back to the
organization's profile page.
Managing Teams
We're going to move the "awesomejt" user from the developers team into a new team.
I'm currently logged into GitHub, and I'm on the "my-organization-example" organization.
If I click on teams, I currently have a single team called developers.
I'm going to create a new team and call this team "Contributors"; and the description I'm going to
use is "Read-only team for less trusted developers".
Then click, create team. While I'm here, I'm going to associate a repository, so click on
"Repositories".
Type "web", which should bring up the website repository, click on that, and I wish to leave
"Read" as the permission for this repository.
Again, read allows team members to view or read this repository, clone it, and also fork the
repository.
Alright, let's head back over to team members.
I'm going to add the "awesomejt" user.
And, at this point, I just have to type the first few letters of the username, and since this user's
already part of this organization this match will show before anyone else on the general GitHub
website.
Once I find my match, I'm going to select it, and this time, since the "awesomejt" user is already
a member of this organization, the "awesomejt" user is directly added to the contributors team;
no invitation is required at this point.
Great, so now let's head back over to teams, and "awesomejt", at this point, is a member of both
contributors and developers.
Let's go over to developers; I need to remove "awesomejt" from developers, so that he only
remains in the "Contributors" team.
So, I'm going to go over to the gear dropdown, and then select "Remove from team".
GitHub will update and remove "awesomejt" from this team.
If I click on teams, I can see that "awesomejt" is still part of the contributors team.
I like setting up my organizations in a fashion like this, where I will have a core team of
developers, and then a team of contributors with different permissions.
Typically my trusted core developers I will give more permissions, in this case read and write,
and then contributors I will give less permissions, in this case only read access.
Organizations Profile
We're going to look at updating the organization's profile.
I'm currently logged into GitHub as the "jasongtaylor" user, and I'm on the "my-organization-
example" organization’s profile.
As the organization's owner, you have access organization’s profile, and can update its settings.
From the profile page click on "Settings".
Like an individual user, the profile has many of the same types of settings that you would
normally associate with an Indi dual, including a profile picture, name, email, and other
information.
Let's update the profile picture.
Click on "Upload new picture".
I'm going to use a wave png that I just downloaded off the internet.
Click open; I'm given the opportunity to crop the picture, then, once you're happy with the crop,
click "Set new profile picture".
Once that's done, we can continue down the rest of the profile page.
I'm going to use "The Example Organization" for its name, "example@git.training" for the email
address.
For the description, I'm going to use "This is an example organization for GitHub training".
I'm going to use the URL "http://git.training".
And, since I'm located in Florida, I'll set its location as Florida.
And the billing address, which is kept private, can be your own email address that isn't
associated, per se, with the email address for the organization, which is public.
Once you're done updating the profile, click "Update profile".
Great, now the profile has been updated.
Let's do a quick review of the rest of the items in the menu for the profile settings.
Click on "Member privileges"; this allows us to allow members to create repositories in this
organization: by default they can.
The default repository permission, that is when you invite new members to the organization are
given the read permission by default.
You can also update to "Admin", "Write", or "None".
None would only allow members to clone or pull public repositories.
And really, for public repositories, "None" and "Read" have similar effects.
The difference is, is that if you happen to have private repositories, which again would require a
paid membership to GitHub, the read permission would allow read visibility to any private repos
as well as public.
For now, I like keeping it at read.
Team privacy, this allows us to make global changes between making all of our teams visible or
not.
Billing allows us to update our billing information, if we were in the mood to change to a paid
account.
For now, I'm happy with keeping it as free.
Applications allow access through GitHub API; third-party access is a little bit more advanced.
Audit log will show all the events that have happened in the organization.
The audit log also allows us to export, which is available in "CSV" or "JSON" formats.
We can see here all the activity that has taken place since we created the organization.
And then, finally, Webhooks is an advanced topic that relates to how repositories communicate
with outside tools.
Click on the name of the organization to go back to the profile page.
So, as you can see, things have changed a bit since we updated our profile.
So now, instead of "my-organization-example", which is still up here in the URL, the name of
the organization is "The Example Organization", which also has the description, our location in
Florida, the URL, and the public email address.
Destructive Actions
Before we wrap up this section on working with the organization in GitHub, I wanted to go over
some of the more destructive aspects of managing your organization.
First, let's look at people. When we look at our people, we have the option of kicking people out;
so I can select a user and then change the role.
I can convert to an outside contributor, which means this person's no longer a part of the
organization, but is allowed to make contributions, or I can remove from this organization.
For now, I'll leave this person as part of the organization, but I wanted to show you where you
would go to manage that role.
Also, you could click on "Manage access" for a particular user, and then click on "Remove from
organization". Great, now let's click on "Teams".
As a member of any of the teams, you can leave a team, and if you are an owner of the
organization, you can always rejoin a team.
If I click on a team, I can click into settings, and I have the option to delete a team.
I'm going to leave this team intact, but I wanted to show you where you would go to delete the
team in the case that you needed to.
Finally, I'm going to go into settings, and if I scroll all the way down, there are a couple options
that I want to point out.
One is, I have the option to rename the organization.
Renaming the organization is something that has significant repercussions, so I would be very
cautious about doing this.
I'm going to leave this as is, so I'm going to x out of this, and also, at the bottom of the settings
page, I have the option to delete the organization.
Again, I'm going to have to type the name of the organization as a confirmation.
Again, I'm going to x out of this, since I want to keep this organization for later workflows.
Additionally, if I go to my user's profile settings and scroll down, I have an option for
organizations.
From this level, I can also leave the organization.
And, like before, I can go directly to the organization from here or I can click under organization
settings, which would also land me on the organization specific profile page for editing, which
would also allow me to delete the organization or rename it.