---
# System prepended metadata

title: GitHub Tutorial

---

GitHub Tutorial
==


*  Clone a repository:

![](https://i.imgur.com/jjnBSsB.png)


1. copy the url
2. open terminal
3. `git clone url`
4. And then there will be a copy of the repository in your current directory

* Create a branch
    1. If working on team project. You are not supposed to make any changes directly to master. But you can make a branch and do your change on your branch
    2. `cd [repository dir]`
    3. `git fetch`
    4. `git status`
    5. If you find there is any update to the repository then: `git pull origin master`
    6. `git branch BRANCH_NAME_YOU_CREATE` to create a new branch you will be working on
    7. `git branch` to see which branch you are in
    8. if you are not on your own branch `git checkout YOUR_BRANCH_NAME`
    9. Then there will be a copy of master in your branch if your branch is a new branch you create
    10. open any code editor to edit your code

* Commit and push your code
    After you finish editting your code you will want to commit and push your change back to origin, and eventually merge to master
    1. `git status` to check what you have change
    2. `git add filename` add the filename you have change, you can add specific file or all the file using `git add .`
    3. `git commit -m " your commit message ex changes you make"`
    4. `git push origin`

* Make Pull Request
    1. Go to github page repository
    2. Click pull request
    3. make a pull request,by adding some message
    4. just wait for someone to review your code and merge to master

* Delete your old branch
    1. again go back to the repo directory
    2. `git branch` must make sure you are not on the branch you want to delete
    3. if you are on the branch you want to delete `git checkout master`
    4. now you can delete your branch `git branch -D branch_name`