hey what's up guys, welcome back to the show. in this episode we're talking more
about github this time inside of visual studio but first be sure to subscribe
and if you like the channel and the content go over to our patreon page and
show your support there. alright so github has an extension for
Visual Studio and let me tell you this thing is pretty great. now, just like the
github desktop episode there is absolutely no interaction with the
command line. you don't have to know commands and it takes all the stress out of
figuring out the remoting and all of that stuff so it just makes it super easy and
you can find this in the marketplace visual studio marketplace github
extension for visual studio so go ahead and download the vizx
and then just install it and again this does work on 2015 and 2017
all right so once it's installed fire up Visual Studio and you want to go into
the team menu manage connections and then you'll see the flyout window over
here and we've got a couple options maybe you do maybe you don't but either
way you should see the github option if you don't have an account and then go
ahead and sign up we'll go ahead and click on connect and then the connect
dialog go ahead and enter your credentials
now once you've entered your credentials you'll see up here github
you can clone create and sign out so again create if you wanted to create a
new github repo go ahead and click create and you can type in the name
description your local path to where it is on your system your get ignore
profile Visual Studio is selected by default since we are in a visual studio
your license if you want to deal with that and some other options we're not
going to do that we're going to ahead and clone now I already have a
repository or actually several repositories so in the clone window
it'll show you everything that you have either created yourself or that you have
a forked so I'm going to go ahead and use my fluent guard project again
I don't like this path so actually let's go over here to team explorers
team Explorer click home and I'm gonna choose settings global settings and I
want to change my path to something else there we go so in here you can change
your username or email address your default repository location which is
what we just did and then there's some other options in here commit changes
after merge by default and enable push force and then of course you can use or
change and set up your diff tools and your merge tools by default they're set
to use Visual Studio and I like Visual Studio so I'm going to leave those there
so update that now go back home and then actually we'll come up here to manage
connections and then we'll go back to clone
and fluent guard and now our path is set to d:\git and that's what we want so
let's clone that
so now we've cloned our repo and you can see down here which repo you're in down
here at the bottom we are in the fluent guard repo and tells you what the
path is and next to that we can see which branch we're in so this is how we
at least one way that we can manage branches okay so now let's head back
over to team Explorer and now you'll see the repository has cloned successfully
and down here in the local git repository is now we see an entry for
fluent guard and you'll see a complete list here of all your local repositories so
if you have more than one and it makes it easy to just double click them and
connect and open and work with those local repositories
okay so now that we have a repository we
have a couple more options on the home screen we've got changes this is of
course changes to the current repo you're looking at those later branches
you know branches are your pull request we'll be taking a look at those your
sync which is synching your changes to github and then there's a pulse grafts
wiki issues these just take you to the website so if you want to see issues
it'll just open up the web browser and you can see your issues in there
same thing for the wiki and all the other things
okay so we want to make some changes so let's go in here and before we do
anything let's make a branch so in the branches fly out we've got a couple
options and we can see here a fluent guard as our project and we have one
branch master and then we have our remotes down here our origin and it's
pointing to master okay so we're just going to create a new branch and we'll
call this bug fix create the branch
and now our new branch is created and we have checked it out and we know this
because in parentheses next to the repo name it says bug fix and then of course
down here it also says bug fix okay so let's make
a change, change this readme file
okay so we've made a change let's save it now there's a couple options that we
have here if we right click on this file now one thing that I like is we can
compare with unmodified now what this does is it compares your local edited
version to what is currently committed to the repository and so when we compare
we can see our local changes over here on the right and what's in the repo that
has been committed over here on the left
okay so now that we're good with that we can go back to team Explorer and then
go back to home and now we can go to changes so in changes we see quite a lot
going on here not entirely sure what these are but they're dot cache files I
don't really care about these so up here we've got our commit message let's type
that in and once we do that we've enabled our commit all button or we can
drop this down you can commit all commit all and push and commit all and sync so
there's a couple of options there but I don't want to commit all these dot cache
files so we're gonna right click on the readme file and again we have more
options we can view the history specifically of this file again we can
compare it to the unmodified version and we can stage so let's go ahead and stage
our readme file so now what we see is readme has been moved up to the top and
it is under stage changes and now the button up here has changed from commit
all to commit stage and of course we have the same options commit stage and
push commit stage and sync okay so I'm just going to commit staged
and now we have committed our changes to our local repository
so let's go back and switch over to the master branch and again we can come back
in here and we can right-click on our master branch and check out or we can
come down here and click on our bug fix which is our current branch and we can
choose master from the list
and we are now in the master branch okay so let's go ahead and merge our changes
from a bug-fix so we're going to emerge from bug-fix branch into the current
branch which is master and then our options here are commit changes after
merging that's fine let's go ahead and do that
okay so now we have merged our changes from the bug-fix branch into master and
now if we're done with bug fix we can go ahead and right click on it and delete
okay so the last step is now that we have everything committed locally we
need to push our changes up to github and we do this through sync
so in the sync you can see all the commits that are out going you can see
the one here that we just did added text and if you right-click on that you can
view the commit details and you can see down in here and the changes our readme
file and if you want you can view the history
so we've got some history here we've got first commit updated updated remove the
broken article link this is the one that we did in the github desktop video and
then the one that we just did right now and of course you can right-click on
these to view commit details compared with previous you can blame and annotate
and so on okay everything looks good here let's
head back and up here we've got some options sync fetch pull and push so
let's go ahead and sync
so now our new text should be up in github so let's
take a look at that
and there it is "example from visual studio"
so now one last thing is pull requests so from the home
it's like pull requests and we have a contributor who has submitted a pull
request and we can see this here it says added text to demonstrate a pull request
okay and this was done by a code insights demo let's click on this now
inside this pull request we can see what's happening looks like they made
changes to the readme file so let's view of the changes okay it looks like
they added some text
if we like the changes we can go ahead and pull these in unfortunately we have
some uncommitted changes in our working directory because of the dot cache files
these guys here so let's see what we can do about removing these
let's go ahead and ignore these items
you
that looks good to me let's go back home check on changes and
go ahead and commit our ignore file now let's go back to our pull requests
and now it looks like we're good to go click on that
so now the pull request text has come in
so it's pulled on our changes and down here it's pulled into a new branch so
let's switch back over to master
and we can go back to branches and let's merge from
our pull request branch
and there seems to be a conflict let's see what that is
all right if you're familiar with the TFS or the Visual
Studio diff tool in this you'll be right at home with this but if not on the left
here is the conflicting version and on the right is what we currently have
committed so you can check these boxes to determine what shows up down here
this is the final merged result so if we don't want the the text from the pull
request then we can uncheck it or we can check it if we do if we want both then
we can have both so once this down here looks good to you
we come up here to accept merge and there we go
we have resolved the conflicts let's commit the merge and merge from pull
request
okay home changes there's no changes back to home sync
and so we have a couple of things that we need to sync up so if we wanted to
sync those and push those back to github then we do like we did earlier click
sync and we'd be done the github for visual studio extension is really a nice
extension for working with github so if you work with github a lot this will
save you a lot of time and effort okay so that's it for this episode I hope you
enjoyed it be sure to subscribe and if you like
this video click that like button or leave a comment below thanks for
watching