preface
Git is something we must use in our work, but we should not check it when we use it, which will affect our work efficiency. This time, I will summarize it here and divide it into two parts. In the first half, I will introduce Git in detail. Then the following part will mention git operations and processes used in the work, impatient friends can directly skip to the second part.
I’m the first half
What is a git
Git is nothing more than a code management tool for a team. It is very convenient for us to update and merge code, and Git divides our work area into four parts.
-
Git Clone can be used to bring down repository code locally
-
The staging area (index)
Git add.. to add all files in your current directory to your staging area
-
Git commit -m ‘Annotate content’ is used to place the Repository in our local Repository
-
Git remote add origin git remote add origin git remote add origin git remote add origin Git remote -v can also be used to query the remote repository address. This is all I have to write so let’s look at the key points of today’s summary
Git process specification at work
When we’re developing, we’re going to have a general development library and we’re going to do a development based on it and let’s say it’s master
The new branch
We need to get the latest code from the warehouse first
- Git checkout master cuts to the master branch
- Git pull updates the branch code
- Git checkout -b dev create a branch
Submit branch
When we are done with our own functionality, it is also important to note the comments section
git add .
git commit -m 'sichen achieve choosetag'
git push orgin dev
Merging branches
When we want to develop new features, we also update the main branch and merge the main branch code into our own branch, the update is written above and then directly merge, which we do in our own branch
git merge master
Git git git git git git git git git git git
-
Git branch (-r) — View all local branches
-
Git branch name — Create a branch
-
Git branch -d name — Delete a local branch
-
Git checkout -b name> — (create and) switch to the target branch