Code submission for Git labs
Code submission
Generally, there are five steps for code submission:
1. view the current code modification status
2. view the code modification content
3. Save the files to be submitted
4. Submit saved files
5. synchronize data to the server
1. view the current code modification status
Before submitting the code, check the current changes and run the git status Command.
A) saved (changes to be committed)
New file // indicates creating a file
Modified // indicates modifying the file
Deleted // indicates deleting an object
B) modified (changed but not updated)
Modified // indicates modifying the file
Deleted // indicates deleting an object
In addition, git provides possible operation commands, including git add/rm and gitcheckout --
C) untracked files)
2. view the code modification content
Git diff <file>
Compare the differences between a file and the recently submitted node.
Note: If the file is saved temporarily, use git diff-cached <file>
Git diff
Compare the differences between a file submitted on node a and Node B.
Tip: if the next hashcode is omitted, it is compared with the previous submitted node by default. (You can also use the ^ operator)
3. Save the files to be submitted
If a new file is created
Git add <file>
If the file is modified
Git add <file>
If the object is deleted
Git rm <file>
4. Submit saved files
Git commit
Note: Enter the annotation specification.
Git commit -- amend
Last modification submitted. You can use this command to write comments incorrectly or missing files.
5. synchronize data to the server
Before synchronizing code to the server, you must synchronize the server code to the local device.
Command: git pull
If the execution fails, follow the prompts to restore the conflicting files and try again.
Command: git checkout -- <conflicting file path>
Synchronize to server
Command: git push origin <local branch name>
If the execution fails, it is generally because the server code is not synchronized to the local machine. First, execute the above git pull command.
GitHub tutorials
Git tag management details
Git branch management
Git remote repository details
Git local Repository (Repository) Details
Git server setup and Client installation
Git Overview
GitLab details: click here
GitLab: click here
This article permanently updates the link address: