Git系列之一 git remote

2021-09-07 23:56:17 字數 928 閱讀 9468

使用git的時候難免會用到remote tracking,下面簡要記錄一下在使用git remote時的一些技巧

(1)add

$git remote add origin

注:暫以celery的git作為示例,celery是乙個挺不錯的distributed task queue,有很多值得學習的地方,在此也順便推廣一下celery

(2) show remote

$git remote show origin

通過$git remote show origin來得到remote中的所有branch列表

(3)fetch

$git fetch --depth=1 origin master

通過depth來指定獲取最近的多少個commit,可以通過這一引數來根據需要限定獲取的commit個數

(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,檢測當前head和fetch_head之間的區別,如果有區別的話,可以認為是有更新或者變動,如果想通過git來做autoupdate的話,可以根據diff的結果,決定是否重新fetch

(7)create empty empty

$git symbolic-ref head refs/heads/newbranch

$rm .git/index

$git clean -fdx

$git add your files

$git commit -m 'initial commit'

git應用系列之(一)認識bash

shell俗稱殼,是指 提供使用者使用介面 的軟體,接收使用者命令,然後呼叫相應的應用程式。圖形化shell通過友好的視覺化介面,呼叫相應應用程式,如windows系類作業系統,類unix,linux系統上的圖形化應用程式gnome,kde等。命令列shell通過輸入特定命令呼叫相應的應用程式。如w...

SQL Server Index系列之一

agenda index structures primary key and clustered index constraints and indexes syntax for creating and managing indexes special indexes index access ...

Active Directory系列之一

為什麼需要域?對很多剛開始鑽研微軟技術的朋友來說,域是乙個讓他們感到很頭疼的物件。域的重要性毋庸置疑,微軟的重量級服務產品基本上都需要域的支援,很多公司招聘工程師的要求中也都明確要求應聘者熟悉或精通active directory。但域對初學者來說顯得複雜了一些,眾多的技術術語,例如active d...