How to use Github basics
Published: 2024-02-19 01:17:25

Here is how you fork then clone then use github with a friend or more!

Command line vs desktop app

they both achieve the same thing so I am going to show you both


##Step 1 - Fork your repo

find the repo you want to contribute to and click the fork button in the top right of the screen

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rtelx69zvol1c29sexzt.png)

there is a prompt to create that fork and you should absolutely click that big green button on the next page

after you do that you now want to click "code" on your forked webpage and then copy the url that is inside there


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nw2lvh9fedafqwk6n8is.png)

Desktop App

##Step 2 - clone your repo

click "file" then "clone repository"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fh9pzake1icrssu8zgf5.png)

after that a context menu will appear, you will then paste your copied url in that first input area and select a place to have your clone saved, this is important, you should pick somewhere you want this repo saved.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ute54t1w92apt0vgzsv9.png)

and you are pretty much done after doing this, another pop up will appear and you should answer accordingly. If you plan on contributing to this repo then you should select "contribute to the parent project"

##Step 3 - create your branch

so if you want to make changes and contribute to the repo you need to create your own feature branch, then push to your feature branch and create a pull request(or PR)

to do this in the desktop app you select the "Branch" tab, select new branch and name your branch. These names are public and should be a small description on what you want to accomplish. example "add-run"(there are no spaces in these so you use dashs instead)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ftmpig0ewasv0jkwqbsi.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ki5fljhb2n5na64mdoa.png)

after you complete that you will have your own feature branch

##Step 4 - add(push) to your branch

after you made the changes you wanted to make, you click the Repository tab then click "push" and your branch will show the changes


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jn5vl9g7sif9rxaaz5h.png)


##Step 5 - pull request

this is simple too, you click the Branch tab then click "create pull request", it will take you to a web page on github and you can fill out the information as stated. 

what this does is show the other people on the project that you have a branch with changes you want to make to the main branch. This code will have to be first reviewed by the maintainer of the project and if they like it, it will be merged if not then you get to try again or make some changes!


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2m4q4u52tu88rgaen48.png)


Command Line

##Step 2 - Clone your repo

for this its simple, you want to open your command line or terminal

select a place where you want this copy to exist, and paste the following

```bash
git clone -insert url here-
```

the rest will happen on its own


##Step 3 - create your branch

if you want to make changes and contribute to the repo you need to create your own feature branch, then push to your feature branch and create a pull request(or PR)

go to your terminal or command line and add this

```bash
git branch - your branch name -
```

##Step 4 - add(push) to your branch

after you made the changes you wanted to make, you go to your terminal or command line and you post these in order

the "." is shorthand for ALL but you can select specific files you want to add

you then commit those changes along with a short message describing the changes

and finally you push the code. 

This can also be done in the UI of VS code

```bash
git add .
git commit -m -Your commit message here-
git push origin - your branch name -
```

##Step 5 - pull request

for this step you want to go to your github account after you pushed your code to your branch, then you will see a a big green button that says compare & pull request you click that button then you fill out the information as requested.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1n2626v81snwc0pgxz8t.jpg)