Git help Document Reading Notes-Chapter 2-Chapter 4-use of remote Repository

Source: Internet
Author: User

Manage these remote repositories so thatPushOrPullData


        1. Add remote database
        2. Remove obsolete remote database
        3. Manage various remote database branches
        4. Define whether to track branches


View the current remote database


You can use the GIT Remote Command to list the short names of each remote database.

You can also add the-V option to display the corresponding clone address:

If there are multiple remote repositories, this command is all listed. For example, in my grit project, you can see:



Add remote Repository


To add a new remote repository, you can specify a simple name for future reference and run git remote add [shortname] [url].



Capture data from a remote warehouse


$ Git fetch [Remote-name]

Remember that the FETCH command only pulls the remote data to the local warehouse and does not automatically merge the data to the current work branch. You can only merge the data manually when it is ready.


If you have set a branch to track the branch of a remote repository (see the following section and chapter 3), you can use the GIT pull command to automatically capture data, then, the remote branch is automatically merged to the current branch in the local repository. In our daily work, we often use this method fast and well.



Push data to remote warehouse


Git push [Remote-name] [branch-name].

If you want to push the local master branch to the origin server (again, the clone operation will automatically use the default master and origin names), run the following command:


$ Git push origin master


This command will complete the task on schedule only when the cloned server has the write permission or no one else is pushing data at the same time. If you have already pushed several updates before pushing data, your push operation will be rejected. You must capture their updates locally and merge them into your project before pushing them again.


View remote Repository Information


Use commandsGit remote show [Remote-name]View Details of a remote warehouse


Delete and rename a remote Repository


UseGit remote renameCommand to modify the local abbreviation of a remote Repository


For example, if you want to change PB to Paul, you can run it like this:


$ Git remote rename Pb Paul


Git remote RM command: delete/remove a remote repository.

Chrysanthemum: supports mass blog tools on various major blog websites!

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.