Home > Development Tools > git > body text

What are the common commands for git submission code?

coldplay.xixi
Release: 2023-01-13 00:40:57
Original
68667 people have browsed it

Common commands for git submission code: 1. [git log] to view the records of git merge; 2. git pull to re-pull the code from the server; 3. git status to view the local code status; 4. git add to local code All codes are submitted; 5. You can see the current working branch with the git branch command.

What are the common commands for git submission code?

The operating environment of this article: Windows 7 system, git2.30.0 version, Dell G3 computer.

Common commands for git submission code:

1. Master branch code submission process

git log Check the git merge Record

git pull re-pull the code from the server and update the local code to the latest code on the server

git status Check the status of the local code and see if there is any code to be submitted

git add . Submit all the local code

git commit -m "Incorporate new PUCCH and cell power code" Add comments for this submission

git push origin HEAD:refs/for/master Push the submitted code Go to the main branch

# This If you want to refund the version, use the Git Reset command, Git Reset-SOFT 1C8C4031156E668B4B375DB8D6D2893DFC03ED4A back to the recently submitted state,-Soft The parameter indicates that local modifications are retained, and the --hard parameter indicates that local modifications are not retained.

You can use git commit --amend to achieve incremental submission

2. Master branch and 2.08 Branch switching method

The git branch command can see the current working branch. The current working branch is master

Enter the git branch -a command to view All branches in the git library, you can see that this command lists all branches

Enter git checkout -t remotes/origin/208 to switch to remotes The /origin/208 branch is the 208 branch. You can enter git branch again to view the current branch and find that it has been switched to the 208 branch.

If you want to switch back to the master branch, because the master branch has been formed locally, the switching command is slightly different. The -t parameter is removed, and the branch name is written as the local branch. The name can be: git checkout master

When switching to branch 208 again, because branch 208 has been formed locally, the switching command is slightly different, remove -t parameters, and the branch name can be written as the name of the local branch: git checkout 208

3. 2.08 branch code submission process

208 branch modifications and code submissions need to be done in the 208 branch. For the switching steps, see step 2. The code submission process is basically the same as the master branch, except that the last step needs to be written as git push origin HEAD:refs/for/208, that is, submitted to the 208 branch. The previous steps are basically the same as the master branch. You can refer to step one.

git pull Before submitting the code, update the code to the latest code

## git status View the modified use cases

git add . Add all the modified use cases. You can also use the "git add file name" command to add the modified files individually. After adding, enter git status again and find that the use case status has been changed to Add status

git commit -m "Submit use case", add notes for this submission

git push origin HEAD:refs/for/208 Push the submitted code to the 208 branch

Recommended (free): Git

The above is the detailed content of What are the common commands for git submission code?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
git
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template