天天看點

git指令使用

2015-07-15 11:59:11

git pull : 相當于 SVN up

git status : 相當于 SVN st

git add a.txt: 新添加檔案 或者 将檔案修改儲存到索引中, 和SVN add的作用一樣

git checkout -- a.txt : 忽略本地對a.txt的更改, 将其改回之前的版本 (注意兩個減号)

git commit a.txt : 送出到本地存儲

git push : 送出到遠端版本庫中, 相當于 SVN ci

檢視本地分支: git branch

檢視遠端分支: git branch -r

檢視本地和遠端分支: git branch -a

删除本地分支: git branch -D <branchName>

删除遠端分支: 

    方法一: git push origin --delete <branchName>

    方法二: git push origin :<branchName>

本地建立了分支, 需要同步到遠端版本庫中, 讓其它小夥伴看到

git push origin 本地分支名:遠端分支名

從遠端檢出分支到本地作為新的本地分支

git checkout -b 本地分支名 origin/遠端分支名

設定本地分支與遠端分支關聯