Git remote, one of the GIT Series

Source: Internet
Author: User

You will inevitably use remote tracking when using git. The following briefly describes some tips for using git remote.

(1) Add
$ Git remote add origin https://github.com/ask/celery.git
Note: currently, we use celery's git as an example. Celery is a very good distributed task queue, which is worth learning. Here we will also promote celery.
(2) show remote
$ Git remote show origin
Use $ git remote show origin to obtain all branch lists in remote.
(3) Fetch
$ Git fetch -- depth = 1 origin master
You can use depth to specify the number of recent commit records. You can use this parameter to limit the number of commit records to be obtained.
(4) Create Branch
$ Git branch master
(5) Merge
$ Git checkout master
$ Git merge fetch_head
(6) diff head fetch_head
$ Git diff head fetch_head: detects the differences between the current head and fetch_head. If there is a difference, it can be considered as an update or change. If you want to use git for AutoUpdate, you can decide whether to fetch again based on the diff result.
(7) create empty
$ Git symbolic-ref head refs/heads/newbranch
$ RM. Git/Index
$ Git clean-fdx
$ <Do work>
Git add your files
$Git commit-m'initial commit'

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.