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'