Front-end development internship work on the daily use of git

What is git

Distributed version control system, what is it used for? On the first day of the internship, the leader pulled me into the department's GitLab group. The GitHub repository has been used before, but GitLab is still the first contact. GitLab is an open source project for a warehouse management system. It uses Git as a code management tool and builds a web service on this basis. Public or private projects can be accessed through the web interface. It has functions similar to Github, able to browse source code, manage defects and comments.
To put it simply, our department has a total of 30 large and small projects. The chief architect and minister have full authority. For other colleagues and interns, they are responsible for entering the code storage warehouse of this project. So it can be understood as a project code storage and management warehouse. Because no project is developed by one person, teamwork is inevitable. So for efficient teamwork efficiency. The use of Git becomes particularly important

every morning

When you come to the company, you can first open GitLab to
Insert picture description here
see what your friends did yesterday. Of course there is no such step. This is just my habit.

Pull the project code for the first time

Everything has a first time, and the first operation is different from the subsequent operations.
1. It is the first time to pull down the code of the project, not to mention go directly to the steps. The
git clone http:xxxxxxxxxxxxx
first step is of course to clone the project. Do not go into details
2. It git init
can be understood as initializing a local empty warehouse to store your code.
3. At this time you will see a master followed by your folder name. He is the main branch of this project, but we don't need the content of this branch. So we have to switch to the dev branch and
git checkout -b dev
force to switch to the dev branch . At this time, you will find that the brackets behind the folder on the git command line have become (dev).
4. The next step is to get the resource,
git fetch origin dev
5. Finally, pull the download resource
git pull origin dev

That's it. Drag the folder to VSCode or HBuilder, npm install to download the required dependencies. Just run it again.
After the first pull, we don't need to clone the initial and so on every day in the future. Pull before the start, update to the code written by the latest partner, and then proceed with your development.

every night

After a whole day of hard work, I checked the working tree of VScode, eh! This workload is fine, so I have to upload the code.
Similarly, we must remember that this is a teamwork project. You can't just care about yourself, so the first step is to update the code. Pull the latest code, because maybe some friends have already uploaded the code in the afternoon. If you do not pull down the latest code of others, the problem is self-evident
1. git pull origin dev
2. Check what you have done today,
git status
it will show the same traces of modification as the working tree or adding file folders, routing, etc. . If there is an omission, it means that the code has forgotten to save, so quickly save it.
3. git add .
He will monitor the status tree of the work area, and use it to submit all changes during work to the temporary storage area, including file content modification (modified) and new files (new), but not including deleted files.
Then if you want to
4. git commit -m '今天我干了啥!'
Here is to introduce your work today to your friends, sum it up in the simplest words.
5. git push origin dev
Upload our code! Let's get off work after finishing the workday!

Worth noting

1. The code uploaded every day must not report errors, and the project page displayed by the uploaded code must not have obvious errors (such as adaptive height and width). The first time I used Blue Lake to restore the page based on the ui map, I saw that there was a specific height and width on it. I thought I was going to die... So I paid the IQ tax. Fortunately, it is not difficult to modify. But it seems very stupid in the eyes of a veteran.
2. Git will help us merge the code, but if there is a conflict, you have to manually adjust it yourself. For example, the last small partner modified a piece of code in lululu.vue. It happens that I also need to modify it. Merge issues may occur, which requires you to communicate with your friends. But if you know what he changed, then just change it yourself. For example, last week, my friend modified the overall style of the page, and I want to add a route on this page. Both of us are doing it at the same time. He uploaded the code at 6 o'clock, and I was not over yet. When I uploaded the code at 7 o'clock, I found that the style of this page had changed. For example, it was just a simple div before and he added a box or something. My route jump is wrong, just manually modify it. Or is there a better way?

Write at the back

More than half a month passed quickly, and I really learned a lot. Sometimes I want to summarize that day. As a result, when I arrived home at 8:30, I felt no mood. National Day continues to summarize the problems encountered in the work and the skills learned during the month. The friends I met are very good, and the working atmosphere of the department is also very happy, lucky

Guess you like

Origin blog.csdn.net/qq_42285889/article/details/108689950