Git learning path (5)-synchronization to remote repository and collaboration among multiple people, git path

Source: Internet
Author: User
Tags git shell

Git learning path (5)-synchronization to remote repository and collaboration among multiple people, git path
Too many rows too many rowsIntroduction

  We have written the file and added it to the version library, but this is not done yet. We also need to synchronize it to the remote repository of GitHub. Here we will take the drag project we just started as an example, go to the Git learning path (2)-install GIt and create a version library and clone the drag project to a local file. Assuming that after modification, now we want to synchronize the modified file to the remote repository.

If you have any questions about the previous knowledge, go to learn Git.

 

Zookeeper has been synchronized to the remote warehouse

To add a file to a remote database, you must first determine whether your GitHub account is logged on to the Git Shell and a client with an interface. to synchronize the file to a remote repository, you must record the uploaded user's

View the username and email address in Git Shell

    git config --global user.name    git config --global user.email

  

  

  

If the user name and email address are incorrect, you can directly write the user name and email address at the end.

  

 

After confirming that the user name and email address are correct, view the remote repository name and corresponding address.

// View the remote repository name git remote // view the address git remote-v corresponding to the remote Repository

 

  

 

Next, you can synchronize the data to the remote repository.

Git push remote repository name branch name

 

  

 

In this way, the file is successfully synchronized to the remote repository.

 

 

How does one collaborate with others?

How can we participate in a project or participate in your project?

First, you must grant the participant permission in GitHub.

  

 

  

Click New collaborator, and write the GitHub account of the participant in the red circle. click the button.

 

How can I know whether I can participate in a project as a participant?

  

 

You will receive a similar email in the email address you entered when registering GitHub. You can use the previous knowledge to clone the remote repository and enjoy working with them.

 

How does one resolve collaborative conflicts?

For example, A invited B to participate in the project. Now B has received an email, cloned the remote warehouse, modified the file, and submitted it to the remote warehouse. At this time, the file in computer A is still B before modification. At this time, A encountered A problem when submitting the file to the remote warehouse.

  

  

The file to be submitted conflicts with the file in the remote warehouse. The solution is to use a command to obtain the latest version from the remote warehouse to the local device.

    git fetch

Check the cause of the conflict.

Git diff branch remote repository name/Branch

Merge at last

Git merge remote repository name/Branch

 

  

 

Another method (not recommended) is to omit git fetch and git merge and directly merge it with the latest version.

    git pull origin/master

 

References:

Liao Xuefeng's official website-Git tutorial

CODE help documentation-Chinese Version of Progit

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.