Today we are going to learn the following:
- What is Git/GitHub
- Basic Version Control
- Pulling and Pushing Branches
- Switching/Creating Branches
- Install Git
- If you dont have Git installed, you will need to install it onto your operating system
Operating System | Relevant Links |
---|---|
Windows | Link Here |
Mac | Link Here |
Linux | Link Here |
Additional Notes for Mac
- There are several ways to install git onto your system. of the options, we reccomend homebrew which you can install with the following command:$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
- Next lets try cloning the repo.
- For this we will be using
git clone
. - Make sure you are in the folder you want to put the repo into
git clone https://github.com/SCE-Development/git-workshop.git
- Now we are going to create a branch specifically for you to work on. There are two types of branches that we can use
Local | Remote |
---|---|
Stored on your computer | Stored on Github |
- Today we will be creating a local branch and publishing it onto the workshop repository
We can create our branch a couple different ways:
Using Git Checkout
git checkout -b [INSERT YOUR BRANCH NAME]Using Git Branch
git branch [INSERT YOUR BRANCH NAME]git checkout [INSERT YOUR BRANCH NAME]
- We want to make sure we are currently on our new branch.
-
Make sure to use
git branch
to view the branch you are on. -
You can switch to your branch by using "
git checkout [INSERT YOUR BRANCH NAME]
"Steps:
- Change line 144 in your index.html to your name.
- In your terminal, you want to commit the changes you have made so type the following:
git commit -m "[INSERT YOUR MESSAGE HERE]" index.html
- Once this is complete, you've officially made your first commit.
- Then type
git push
into your terminal
- Remember
git fetch
? Now we should be able to see everyone else's branches on the remote repository when we typegit fetch
.