一、安裝
二、
1、git init
2、git add .
3、git commit -m "first commit"
4、git remote add <遠(yuǎn)程倉(cāng)庫(kù)別名> <遠(yuǎn)程倉(cāng)庫(kù)地址>? ?exp: git remote add develop http://xxx.xxx.xxx.xxx/xx/xx/xx.git
5、git push -f <遠(yuǎn)程主機(jī)名> <本地分支名>:<遠(yuǎn)程分支名> exp: git push -f develop master:develop
-f 暴力推送? 強(qiáng)制覆蓋? 或者先把git的東西fetch到你本地然后merge后再push? ?git fetch? git merge
查看本地分支? ? git branch
切換分支? ? ? ? ? git checkout
創(chuàng)建本地分支? git branch <new-branch>
刪除本地分支? git branch -d <branch>
查看遠(yuǎn)程分支? git branch -a
clone遠(yuǎn)程特定分支到本地分支? git clone <遠(yuǎn)程主機(jī)名> <遠(yuǎn)程分子名>:<本地分支名>
創(chuàng)建遠(yuǎn)程分支? git push <遠(yuǎn)程主機(jī)名> <本地分支名>:<遠(yuǎn)程分支名>
刪除遠(yuǎn)程分支? 分兩步? 1、git branch -r -d <遠(yuǎn)程主機(jī)名>/<分支名> 2、git push <遠(yuǎn)程主機(jī)名>:<分支名>
clone遠(yuǎn)程特定分支? 1、先切換到指定的遠(yuǎn)程分支 git checkout --track <遠(yuǎn)程主機(jī)名>/<遠(yuǎn)程分支名>? ?2、git clone??
注意該命令由于帶有--track參數(shù),所以要求git1.6.4以上!這樣git會(huì)自動(dòng)切換到分支。
當(dāng)你處于master branch, 默認(rèn)的remote就是origin。
當(dāng)你在master branch上使用git pull時(shí),沒(méi)有指定remote和branch,那么git就會(huì)采用默認(rèn)的remote(也就是origin)來(lái)merge在master branch上所有的改變