天天看點

github使用介紹

Git支援多種協定,預設的

git://

使用ssh,但也可以使用

https

等其他協定。

使用

https

除了速度慢以外,還有個最大的麻煩是每次推送都必須輸入密碼,但是在某些隻開放http端口的公司内部就無法使用

ssh

協定而隻能用

https

使用https:

git clone https://[email protected]/Tenderrain/gitskills.git

需要輸入github注冊使用者對應的密碼

使用ssh:

git clone [email protected]:Tenderrain/gitskills.git(#me:域名後面是冒号)

不需要輸入密碼

HEAD指向分支(指針),分支指向送出!

git log --graph --pretty=oneline --abbrev-commit

--abbrev-commit   隻保留commit id 的前幾位

--pretty=oneline  去除Author、Date等資訊,隻保留commit資訊

--graph

           可以看到分支合并圖

分支合并

使用Fast-forward

git merge dev      

提示Fast-forward

資訊,Git告訴我們,這次合并是“快進模式”,也就是直接把

master

指向

dev

的目前送出,是以合并速度非常快。如圖

當然,也不是每次合并都能

Fast-forward

,我們後面會将其他方式的合并。通常,合并分支時,如果可能,Git會用

Fast forward

模式,但這種模式下,删除分支後,會丢掉分支資訊。如果要強制禁用

Fast forward

模式,Git就會在merge時生成一個新的commit,這樣,從分支曆史上就可以看出分支資訊。

不使用Fast-forward

git merge --no-ff -m "merge with no-ff" dev