Code submission for Git labs

Source: Internet
Author: User

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:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.