What is GitHub — How to use it?
GitHub is a storage space integrated with git software. Please do not confuse Git with GitHub. Git is version control system. GitHub is a storage area where we can add our projects as private and public. When we define the projects we transfer to GitHub as public, we allow users around the world to examine our code structure and in this case, we get the chance to see our minuses and pros.
At the same time, by examining the projects of other users, we can find the opportunity to improve ourselves in terms of new ideas and perspectives and to correct our shortcomings. Thanks to GitHub, we have the opportunity to work together by adding the people we want to our project.
Project and Configuration to GitHub
After completing the registration to GitHub, we create a new project by clicking the New repository from the “+” icon at the top right.
Then we set the name and visibility of our project here.
After these processes, we can transfer the project we coded via Git (version control) or IDe to our GitHub repository.
We open the folder where our project is located and right click with the mouse in an empty area and click on the Git Bash Here section and our Git terminal opens. Then we add our username and e-mail to the terminal by making the following definitions.
git config — global user.name “example”
git config — global user.email “email@example.com”
Then, by entering the git.init command, we create a hidden git file in our project, thus indicating that our project is a git project.
Our files in the folder git.add. This command means that we will add all the files. If we want, we can add the file name we want to add after the git.add command. After doing this, we add the git commit -m “first commit” to the git standby repository.
git remote add origin We match the project with our GitHub remote repository. Then there is a final transaction left.We add our project with git push -u origin master. If you get an error, you can do this git push origin master — force
- pwd → Returns the full address of the current directory.
- Ls → List the files in the directory.
- cd → Change directory.
- git log → Gives the received version information.
- git diff → Shows sections newly added to the project.
- git status → Shows the changes made.
Submitting a Project to GitHub
First of all, we need to create a new warehouse. For this, let’s create our repository from the New Repository tab or the plus button. It asks us to enter a name for our repository, whether our repository is public or will be created privately. If we want a private warehouse, we create a public warehouse as we will have to pay some money. We will apply what we learned in our previous topic, git, here. Open the terminal and connect to the directory you want to post on github.
git remote add githubDepo
Branch git is a copy of your project. The master branch that comes by default in our Git project is a branch that covers the entire project. When a copy is taken from the master branch, we create a new branch. If you ask what these branches are taken for, they are used to create a branch for teammates working in your project and combine them with the master branch at the end of the work and connect the modules developed by the team members to the master branch and make them a single project.
We list the branches with the command. If we want to view branches in the remote repository, we use the command:
git branch — all
This file is the description part of your project you created earlier. You can make sure that people who visit the project understand your project by giving brief information about your project before reading your codes. To add the Readme file to your project, use the Add a readme button on github. The codes you can use in the opened area are as follows:
## project purpose Using 1–6 frames allows to increase and decrease the font size.
** double asterisks are used to write in bold **
* italic text written with a single asterisk *
`we use forward quotes to write code`
Watch, Star and Fork
Watch: Used to follow a project on Github.
Star: It means you like the project and you can review the projects you starred later.
Fork: Used when you want to have a copy of the project into your account.
Problems, suggestions etc. regarding your project. It is used to get help, suggestions, solutions from other people. We can use the new issues button in the issues tab to create an issue related to your project. After entering the requested information, you can publish issues and close when you reach the result.