Github Tutorial For Beginners – Github Basics for Mac or Windows & Source Control Basics
- December 20, 2023
- Posted by: MainInstructor
- Category: Go
Video Title: Github Tutorial For Beginners – Github Basics for Mac or Windows & Source Control Basics
Hey there today we’re going to be learning about GitHub and we’re also going to be learning about Source control if you guys I’m pretty sure you’re sitting in one of probably three boats right now one you have no idea what GitHub is no one’s talked about it
You’ve not heard about it and I’m here to talk about it because it’s really important and pretty much any professional company is going to be using GitHub or something like it and we’ll expect you to know it uh or you’re sitting in boat number two uh you’ve
Heard about it you know about it but you haven’t learned it yet it’s kind of been a black box we’re going to make that an easy thing to learn today and step three you person number three you’ve maybe used sub subversion or CVS you know what
Source control is you just want to learn GitHub this might not be the tutorial for you um because I’ll be getting a little bit more ground level stuff here but you’ll learn it all it just might be a little bit slower paced for you so let’s get into real quick what is Source
Control why is it important why is every employer value it uh let’s say there’s two people right here pretend my screen is divided here and these are two guys uh up here we have John and down here we have Bobby so let’s say this is the exact same file um open on John’s
Computer open on Bobby’s computer and John edits this thing and he adds an item in here he adds An Li and he adds um sand uh now how does Bobby get that change if Bobby’s already made five changes added his own stuff down here now you’ve got to get together and get
In a room you’ve got to open up both copies of the file it gets messy as you can imagine in a company of 10 people it gets messy almost instantly what do you do uh another common Pro problem is uh people overriding people’s stuff deleting people’s stuff having to check
Out files there’s really no clean way to do it people have to be able to work on the same files at the same time without hours and hours hour of wasted work and unnecessary communication that’s where Source control came in uh what GitHub will do or git will do for you is you
Open a git project and that keeps track of all the changes that you make so when I make this change it knows that I’ve made this change and then I can at any time connect and find out anyone else’s changes so let’s say Bobby’s added uh I
Forget what it is rope I don’t know why you use rope if you’re building the brick wall at any time I can sync up to the repository and it will pull in the fact that Bobby made and saved this change and so then I won’t lose any work
It’ll just automatically boom boom boom throw in everyone else’s changes and at the same time he can do the same thing he can sync up to the repository and get my changes every once in a while you’ll get what’s called a merge conflict and that’s when both I have edited this line
I’m going to call it uh good mortar and he’s going to call this more mortar and if he saves that and then I sync up to the repository it’s not going to know who’s right it’s just going to know I changed it and Bobby changed it so I’ll get something like this
Depending on what kind of source control I’m using I’ll get your version something that looks an output like this and it’ll say it’s a conflict and all a sudden I have to go okay hm one of these is the right one which one’s the right one Bobby changed this I
Change this um oh I know what I’ll do I’ll go more good mortar there we go and then I’ll get rid of all this junk and I’ll save my file and now I had to manually merge changes that will still happen sometimes but GitHub will flag for you everything that
Both people have done the way to minimize having to do that cuz that is kind of a pain in the rear and there’s really no way around it is to make sure you have good communication on generally who’s working on what tasks and that shouldn’t happen very often and when it
Does it shouldn’t be much bigger than what I just kind of showed you right there so let’s get into GitHub let’s get into an actual project and how we’re going to set this up and manage this uh first thing you’ll need to do is you’ll need to get GitHub installed on your
Computer and you’ll need to sign up for a GitHub account so go to github.com and sign up for an account it’s free um and then also go to mac. github.com or windows. github.com and install the GitHub application that will take care of everything else you need for you
Right there and it will give you a visual application uh which I will tell you not to use so this is the visual application it will give you it’s super easy really easy to get started but a lot of employers look down on it uh because
Lots of people use this as a crutch instead of actually learning the command line the command line is not hard it’s about five commands uh a lot of people just avoid it like the play cuz seeing a black screen freaks them out but we’re going to get past that fear today and
Have a great time with it so uh I’m going to go ahead now and create a new repository think of repository equals project whatever uh I already did one called get tutorial as a test so new git test so I’m making a repository called new git test and the only thing I’m
Going to check here is initialize this repository with a read me and that allows me to clone it right away I’ll show you what that means so you see it made a new repository for me called new get test I already have my first file which is called readme and all the
Readme has is this uh what the readme is is it’s kind of any instructions you’re going to give to people who use this repository it’s automatically displayed when you open up the repository so all I’m going to do here is I’m going to copy this clone URL this
Is what I will use to get it on my machine okay that’s all I need to do for GitHub so now I’m going to use yes the dreaded command line lots of you guys have been avoiding this uh because you’re terrified of it you don’t know
What to do with it and uh we’re going to get into this today so uh if you’re on Mac you only need to know like three commands to actually use this thing and then github’s five commands uh and if you’re on Windows same thing uh to open
It with Mac you go to utilities applications utilities terminal and then to open it on Windows you’re going to go run and type CMD and hit enter so basically CD uh is your change directory command so if I go CD dot dot I’m going to go up
A directory I just went from documents into wheels so now I can go CD back into documents there we go I can also go CD dot dot now I’m in users I can go CD will documents and now that’s basically CD that’s your first command and the other
One is going to be LS and that’ll show you a listing of all the files in your directory if you’re on Windows it’s going to be dir unless you have fake Linux Mac commands installed so you can see I have a few files in my documents
Thing not much uh what I’m going to do is I want to put the repository in documents so I’m going to go get clone and I’m going to paste that URL that I copied clone is your first get command what that does is it takes that repository and it copies the whole thing
Down and puts it in a folder called its name by its name so now if I hit LS you can see that I have a folder called new get test so CD new get test and LS I’ve got readme.md that’s my only file okay that’s about all I’m going to
Do for for now let me go ahead and add that folder to my project here and new get test there we go so now I’ve got my folder and I can do away with you you’re not necessary anymore actually I’ll wait for a second and when
I’m going to do down here is let’s say John Bob does the same thing he’s going to go get clone not readme MD this URL John is also working on our project so he also is going to clone it you notice I’ve cloned it into a different
Folder so you can actually have the same folder on your computer in 20 different places and this one’s in my GitHub folder there we go so now we both have the repository here and I’m going to go ahead over here on the top and I’m going to make a new
File I’m going to save it as new get test we’ll call it index.html and let’s make something here real quick let’s make our first list here we’ll just kind of recreate what we had bricks bricks and Mort let’s just make it a list of two items I’ll save it and
You notice I got index.html there and John still doesn’t have anything cuz he’s not he’s just working on his own let me go ahead and I’ll make a new file here for John and we’ll call it index 2html and we just make it we’ll just do this
UL we’ll just leave it like that so John’s got index to I’ve got index and we’re both working on the project and that’s all the progress we’ve made so here are you ready here’s we’ve got our first get command which is get clone that’s going to pull any repository in
Using its URL our next get command is get status so this is going to show us what’s different between us and GitHub up in the sky right now so all that’s different now is there’s an untracked file we have created a file called index.html GitHub has no clue that this
File exists so what I’m going to do right now is I’m going to do get add which means we’re going to add any change or any new files or whatever by name so add index.html so now we’ve said okay put this guy into our project if I do get
Status again you’ll notice that it’s now a change to be committed we have a new file index.html so now all I have to do is I’ve added it I can go get commit which means I’m locking it in to the repository get commit m-m means I’m giving it a message message and the
Message is going to be in quotes added index.html there we go so now it’s committed but it’s still on my machine it’s locked into the repository but it’s not synced up to github.com yet so all we have to do to get it to do a sync is
Get push that’s going to take anything on our machine and push it up to github.com so now if I go to github.com and I refresh you’ll notice I have index.html so there we go now it’s up there I’m go and hide this and so now if
This guy here goes get pull which is so push pushes up to github.com and pull is going to pull down from github.com whoops I’m not in the right directory cdspace new G test get pull these commands will only work when you’re in the directory of your GitHub repository because you can
Have a hundred different repositories on your computer so I did a get pull and you see it pulled in index.html now I’ve got them both so now what John’s going to do is John’s got this guy and I’m also going to add an item to my list here
Sand so now if I do get status I see two things I’ve modified index.html and I have an untracked file myself so I can do get add index.html and you’ll see that now if I do get status the changes for commit are that I’ve modified this guy o sorry
Wrong one changes to be committed that I’ve modified this and I still have an untracked file that’s not ready to be committed so I can do get add index 2 another thing you can do is you can do get add dot which is going to do everything in your directory or you can
Do GI add- capital A which is going to do get add all so I’m going to do get add a and now if I do get status you see that I’ve got two files ready to go one that’s modified one that’s brand new and I’m going to do a terribly
Generic get commit which is a bad idea made changes that’s not useful to anyone but oh well so I’ve added committed I’m going to push and now over here I’m going to pull get pull but before I yeah so get pull there we go and so now I’ve noticed I’ve got
Index two and my index One automatically has all the updated changes if five different people were working on these files and I did a pull it’d get everybody’s changes as long as they pushed them up so that’s kind of how it works you’ll notice the commands aren’t
Too bad so far we’ve got get status get add get commit get push get pull and that’s kind of your Basics into GitHub there’s about 10 commands in total if I just type get it’ll show me kind of all the commands that I can use and kind of what they do
Um and that’s pretty much the beginning of GitHub so let’s talk about a little bit about workflow how do you actually do this so one thing I’ll do is when I come in at the beginning of each day I’m going to start off by doing a get poll
Want to make sure I get everybody’s updates from all you know last night the rest of the day hey already up to date great I’m going to make my changes da da da da this isn’t mortar anymore it’s now called I don’t know something else quick
Create I think that’s how you spell it made that change um and so now I’m ready to push my changes up I’m going to add everything made Mt more specific got it got all my changes done I’m ready to sync up all my work to the repository I’ll do this with every kind
Of incremental piece of work I do I will probably add commits all throughout the day and then every few hours in the day I’m going to make sure I’m in sync to make sure I don’t get way far far off of stuff let’s create what’s called a merge
Conflict here instead of mortar I’m going to put I’m going to change this to more mortar I think we already went through that example so get add a get commit let’s say down here at the bottom what’s this guy’s name again Bobby Bobby just made a change on a line that I made
A change on um and so now when I do a get pull ah it says conflict merge conflict in index.html you have to fix the conflicts and then commit the result basically you’ve both changed these lines and at first this looks like crazy freaking out
Ah what the heck do I do with this all it’s telling me is is head which is what I’m on we made this change to this line and somebody else made this change so what do we do about it I’m not smart enough to know you’ve got to figure this
Out it’s not too bad I just look at the two lines and say ah okay he was adding more which is our company’s way of saying we need to get more than one so I’m just going to do more quick CR I’m going to kind of manually merge those
Lines together or I’m going to just say no quick create is the right line he didn’t really know what he was talking about we don’t ever say more anyway I manually make the decision I delete all the helper things that it gave me save my file and now I just hit get commit
With nothing in there whoops get add a get commit forgot to add it you notice it said okay now it’s continuing my merge branch of Master and by the way if you ever accidentally hit commit without a message or anything you’ll get this screen you won’t figure out how to get
Out of it you hit Escape colon WQ to save it Escape colon WQ there you go merge Branch Master yes Escape colon WQ is the most complicated part of everything we’re going to learn today just write that one down it takes a long time and I’m always forgetting it Escape
Colon WQ is how you get out of a full-blown commit I’ll show you real quick just what that was so let’s say I made a change now I can modified index get add a it’s commit if you ever just hit commit without the dasm it’s going to open up this same
Thing it’s for a full-blown message is what it is it’s for a multi-line message there you go so that’s kind of what that was it was like a multi-line commit message once again Escape colon WQ enter and there you go get push and now he can do a get
Poll he can find find out that I’ve deleted that line there you go and that is your intro to GitHub once again get commit get add a get push get pull that’s about it have a great day
-
Sale!
Wireless WIFI Repeater Extender Amplifier Booster 300Mbps
$29.99$14.99 Add to cartWireless WIFI Repeater Extender Amplifier Booster 300Mbps
Categories: Electronics, Wi-Fi Router, Wireless Wi-Fi Extender Tags: 300Mbps, 802.11N, Amplifier, Booster, Extender, mobile wi-fi booster, Remote, WIFI, Wireless, Wireless WIFI, Wireless WIFI Repeater, Wireless WIFI Repeater Extender, Wireless WIFI Repeater Extender Amplifier, Wireless WIFI Repeater Extender Amplifier Booster, Wireless WIFI Repeater Extender Amplifier Booster 300Mbps$29.99$14.99 -
Sale!
Full RGB Light Design Gaming Headset Headphones with Mic
$24.99$14.99 Add to cartFull RGB Light Design Gaming Headset Headphones with Mic
Categories: Electronics, Gaming, Gaming Headsets Tags: Design, Full, Full RGB Light Design Gaming Headset, Full RGB Light Design Gaming Headset Headphones, Full RGB Light Design Gaming Headset Headphones with Mic, Gamer, Gaming, Gaming Headset Headphones, gaming headset wireless, Headphone, Headphones, Headset, Light, Mic, Package, RGB$24.99$14.99 -
Sale!
Wireless BlueTooth Multi-Device Keyboard Mouse Combo
$39.99$19.99 Add to cartWireless BlueTooth Multi-Device Keyboard Mouse Combo
Categories: Electronics, Gaming, Gaming Keyboards, Keyboard Mouse Combos Tags: Combo, Keyboard, keyboard mouse combos, Mouse, MultiDevice, Set, WireKeyboard Mouse Combo, Wireless, Wireless BlueTooth Keyboard Mouse Combo, Wireless BlueTooth Keyboard Mouse Combos, Wireless BlueTooth Multi-Device Keyboard Mouse Combo, Wireless BlueTooth Multi-Device Keyboard Mouse Combos$39.99$19.99 -
Sale!
High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
$199.99$139.99 Add to cartHigh Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar
Categories: Gaming, Gaming Chairs Tags: Adjustable, Chair, computer chairs, Desk, Executive, Gaming, Girl, Headrest, High, High Back Leather Executive Adjustable Swivel Gaming Chair, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest, High Back Leather Executive Adjustable Swivel Gaming Chair with Headrest and Lumbar, High Back Leather Executive Adjustable Swivel Gaming Chairs, Leather, Lumbar, Office, Racing, Swivel$199.99$139.99 -
Sale!
Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
$29.99$19.99 Select optionsProfessional LED Light Wired Gaming Headphones with Noise Cancelling Microphone
SKU: N/A Categories: Electronics, Gaming, Gaming Headsets Tags: Cancelling, Gaming, Gaming Headphones with Noise Cancelling Microphone, gaming headset, Headphones, Headset, LED, Light, Mic, Microphone, Noise, Professional, Professional LED Light Wired Gaming Headphones, Professional LED Light Wired Gaming Headphones with Noise Cancelling Microphone, Wired, Wired Gaming Headphones, Wired Gaming Headphones with Noise Cancelling Microphone$29.99$19.99 -
Sale!
Gaming Desk with LED Lights USB Power Outlets and Charging Ports
$349.99$249.99 Select optionsGaming Desk with LED Lights USB Power Outlets and Charging Ports
SKU: N/A Categories: Computer Desk, Gaming, Gaming Desk Tags: and Charging Ports, Charging, Desk, Desks, Gaming, gaming desk with led lights, Gaming Desks with LED Lights, Home, LED, Lights, Monitor, Office, Outlets, Port, Power, Room, Stand, USB, USB Power Outlets, White, Workstation$349.99$249.99 -
Sale!
Wired Mixed Backlit Anti-Ghosting Gaming Keyboard
$99.99$79.99 Add to cartWired Mixed Backlit Anti-Ghosting Gaming Keyboard
Categories: Electronics, Gaming, Gaming Keyboards Tags: Antighosting, Backlit, Blue, brown, Gaming, Gaming Keyboard, gaming keyboards, gaming keyboards and mouse, Keyboard, Laptop, Switch, Wired, Wired Mixed Backlit Anti-Ghosting Gaming Keyboard, Wired Mixed Backlit Anti-Ghosting Gaming Keyboards, Wired Mixed Backlit Gaming Keyboard$99.99$79.99 -
Sale!
Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
$119.99$59.99 Add to cartWireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset
Categories: Electronics, Gaming, Gaming Headsets Tags: 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, ANC, Audio, Bluetooth, Cancellation, Ear, Earphone, gaming headset, Headphones, Headset, Hi-Res Over the Ear Headphones Headset, HiRes, Noise, Wireless, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Headphones, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headset, Wireless Bluetooth 5.3 ANC Noise Cancellation Hi-Res Over the Ear Headphones Headsets$119.99$59.99 -
Sale!
Wired Sports Gaming Headset Earbuds with Microphone
$19.99$9.99 Select optionsWired Sports Gaming Headset Earbuds with Microphone
SKU: N/A Categories: Gaming, Gaming Headsets Tags: Accessories, Earbud, Earphone, Earphones, Gaming, gaming headset with microphone, Headphones, Headset, IOS, Microphone, Sports, Wired, Wired Sports Gaming Headset Earbuds, Wired Sports Gaming Headset Earbuds with Microphone, Wired Sports Headset Earbuds$19.99$9.99 -
Sale!
150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
$49.99$29.99 Add to cart150W Universal Multi USB Fast Charger 16 Port MAX Charging Station
Categories: Charging Stations, Electronics Tags: 150W, 150W Charging Station, 150W Universal Multi USB Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Station, 150W Universal Multi USB Fast Charger 16 Port MAX Charging Stations, 150W Universal Multi USB MAX Charging Station, 16 Port MAX Charging Station, 3.5A, Charger, Charging, Fast, laptop charging stations, Max, Multi, Port, Stand, Station, Universal, USB$49.99$29.99
this github lecture is not suitable for a beginner. I have found other video that can explain well. but still, thank you for your work!
For some reason the cloning part with "git clone (url)" does not work on windows and it says that it is does recognized as an internal or external command? What's up?
The year is currently 2022 – and your advice was timeless and appreciated.
so helpful thank you
I'm still not getting how to link git and vs because everyone talks so fast. I was able to download the version source (thanks for your help) but now when I go to Run – CMD it s not linking did I do something wrong in Git?
Beta tester od roku 2016 oceňujem,,
8 year old video, still makes sense… beautifully explained… no crap, real Information… thanks a ton bro!
Legendary
This video was very helpful. One thing you might want to consider adding, is how to roll back a change.
Question at 5:20: So are you using the GitHub app you just installed to create the repository? Or just GitHub? Can't you use the command line to create a repository? When should you use the – I don't know what to call it since it's probably not the installed app – GitHub? and when should you use the command line? There's already 3 different interfaces and no explanation. This is so frustrating.
Question at 5:10: Do you need to install the GitHub app if you'll never use it? I honestly can't tell why we're being told to install it if we're not going to use it. Maybe you mean we CAN install it if we WANT to use it, but you recommend the command line instead? Or maybe the app is doing something behind the scenes that's necessary even if you never use the UI?
are the commands different for windows
Nicely explained! Thank you!
I forced myself to love the command line 😂
Great job… Keep up the good work
For anyone watching post August 13th 2021, you will need to setup a personal access token with "repo" selected to use the command line to access your repositories. Once you have that setup, you can just enter the PAT when it asks for the password in CMD.
April 2021 Learn with Leon 100Devs. Let's git
esc :wq
Bad tutorial. Bro doesn't even show you how to generate SSH keys and connect lmao
I'm sitting here and 01:27 in the morning in March 2022 and I am so glad I found this video! Thank you!