Github User Guide and Common Developer Issues
- 24-07-2022
- Toanngo92
- 0 Comments
Mục lục
About github:
In programming work, programmers always have to hone their teamwork skills, a project can have a lot of different coders, so how can you manage the entire source code effectively when each person Join code a component in the project? Github and SVN were born to solve this problem for programmers. In this article, let's discuss the github approach from basic to advanced for NEWBIE!
GitHub is a project management system and source code version, which acts like a social network for programmers. Programmers can clone the source code from the repository and Github is a public repository server service, each person can create an account on it to create their own repositories to have can store source code for work. In addition to the storage purpose, github provides powerful methods to help developers easily work as a team, manage/check the code revision history, split the project work without much problem. conflicting issues such as traditional source code archiving.
For the easiest access to Github, you should try with gitHub Desktop , which is a source code management software with a desktop installation interface developed and made available by github, easy to use for newbies, and works well. on macOs and Windows (I can't see ubuntu, it's a disadvantage, but those who use ubuntu or code for a long time will probably love using the command line or git integrated on the IDE, not using github desktop 😅) .
Installation steps:
- Register an account at https://github.com
- Access github Desktop download link: https://desktop.github.com/
- Install the newly downloaded .msi file
- After successful installation, log in to your github account on the github Desktop interface and start experiencing
List of github Desktop concepts and feature descriptions:
Working with Repository (source code repository)
RRepository we can understand it as a repository, which will store files and record the entire state, history of folders and files in the project source code. The saved state is being stored as the content's change history. By placing the directory where you want to manage the change history under the management of the repository, it is possible to record the change history of the directories and files in that directory, and update the notes for the changed versions. make maintenance more efficient.
Branch concept
Branch is something that uses source code branching and records code update history. The branched branch will not affect other branches, so it is possible to make multiple changes simultaneously in the same repository. It can be thought of like sharing the same source code, copying out 5 copies so that 5 programmers can code the same project on a project and save history, although 5 people have worked together and the source code changes a lot, but each a dev is a different version, including the original version will not change anything, making the source code quality control more effective, usually the lead will review the code of the branches, if it meets the quality will update (merge code) to main branch (official version of source code). In each branch, there can still be many people working and updating the code, of course, the operations need to be smooth to avoid conflict (conflict) when 2 or more programmers update the same files, or after they have fixed the files. function that is called by another function causes an unexpected error…
Remote repository concept
Pull : when performing a pull, will get the latest source code from the Repository.
Commit : (confirms changed data)
Push : Put the confirmed data on the branch after commit
Fetch : Refresh data (imagine like 2 programmers A and B putting new code on a branch, programmer C fetch to refresh the branch to see if there is any change in the branch, and then execute it. pull work to pull the newly updated code of 2 LTV A and B.
Install github for windows environment and integrate into visual studio code
If you already understand the concepts of GIT, want to find a better solution to increase performance when coding, watch this short video.
Some common problems with github:
After creating the file and pushing the code, github does not recognize uppercase and lowercase letters causing a situation when changing the source code runtime environment, some files will not be recognized and cause errors
Solution: use the command on git bash to change the file name from lowercase to uppercase or vice versa, for example below I need to change the file name from solutionCategoryController to SolutionCategoryController in laravel project
git mv app/Http/Controllers/solutionCategoryController.php app/Http/Controllers/SolutionCategoryController.php
Reference link: https://stackoverflow.com/questions/10523849/changing-capitalization-of-filenames-in-git