- I spend a lot of time getting my GitHub projects
just right so that when I begin a new project
I really don't want to start from scratch.
Like most people, I like to begin
with a copy of a previous project
and use that as some sort of template.
Now if you watched the previous video
you know that the responsivebootstrap project
is a really good starter for either a bootstrap
or any other kind of regular HTML project.
It has a live reload feature that I created
using Gold JS as well as a JS hint file
that will check my JavaScript and HTML.
So if I want to use this as a starter template
I don't want to get the final branch of this project.
I created a special branch called 00_start
that is a copy of this project at the beginning.
So if I want a copy a specific branch from a GitHub project
I'm going to copy the URL to the clipboard
and then I'm going to go to my terminal application.
In here what I want to do is issue a special clone command.
First, we want to make sure that we're on the desktop
because that's where I want to put my project.
So I'm going to do a cd ~/Desktop.
On a PC remember you want to be using Git Bash
so that it recognizes all of the Unix commands
and once I am in the desktop I'm going to issue
a git clone and then I'm going to do a -b
and then specify the branch that I want to copy.
So I'll say 00_start and then I'm going to
paste the git clone URL.
So what this will do is adjust copy
the start branch into this GitHub repository.
So now if we take a look at my desktop
I have just this responsivebootstrap folder
and we can open this up in a text editor
to see that it's just a simpler version
of my entire project.
We can go in here and get rid of
any of these folders or files that we're not going to need.
Obviously this has a lot of information
about that particular website.
But before I do that, let me take a look at the log.
So if we go to the terminal and execute a git log command,
actually I need to first make sure that
I'm in that directory.
So let's go ahead and cd to responsivebootstrap
and now that we're in here we can say git log.
This is going to show you that even though
this version of the project's pretty new,
I've still logged a lot of different things.
And so, what I want to do is sort of
get rid of everything to do with git
so that I can use this project as its' own starter.
So let's go ahead and control z here
and what I'm going to do is just get rid
of the git folder.
So if we do an ls command we'll notice
that there is a git folder right here
and this is actually what allows us to look
at all the logs, look at all the different branches,
etcetera, etcetera.
So what I'll do is just do a rm, for remove,
not a git rm, just a regular rm in Unix,
and then do -dfr, that's going to delete
and then not ask you if you want to make sure
that you want delete something.
Then recursively delete any sub-folders
within the folder that we're asking for
and then just do .git.
This is a dangerous command so make sure
that you are typing the right thing in here
because this is going to delete that folder
and not ask you anything about it.
So we just execute that command
and if you try to do a git log command
it says that this is not a git repository at all.
It doesn't understand any git commands anymore.
Let's go ahead and clear that out
and if we go back into our text editor
you'll see that all these files are here
and now this is essentially a brand new project.
I can go in here and get rid of anything
that I don't want to include in this new project.
So it'd probably clear out anything in my style.css file
and make sure that I clear out any script.
This is empty right now and then I would maybe
get rid of any JavaScript libraries that I'm not using here
and modify my index.html file so that it was
pretty much empty.
This has a little bit of useful stuff in here
if I was building a git project
so I might leave this as is.
Then whenever I'm ready to make this
be a brand new git project, I can execute
a git init command and now it's going to initialize
this as a new repository with absolutely nothing in the log.
So I could git add everything, git commit -m,
type in a "first commit" message
and now it's added everything into git
as if it were a new project.
So once you have downloaded a branch
to use as a template, you can go in
and remove the git folder.
That means that it's just a normal folder.
You can kind of mess around with the template.
Get it just how you want it and then use it as
a great starter for your projects.
Let me go ahead and delete this
because we don't really need this anymore.
That's how you get started making
a template from a specific git branch
that you can get in GitHub.