How to use Github basics
Samejima
Posted on February 19, 2024
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
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
Desktop App
Step 2 - clone your repo
click "file" then "clone repository"
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.
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)
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
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!
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
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
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
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.
Posted on February 19, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024