拉取代碼
1.克隆代碼
git clone www.xxxxss.git
2.查看所有分支
git branch -a
3.選擇遠(yuǎn)程分支,并同步至本地
git checkout --track origin/分支名 (比如 origin/dev)
提交代碼
4.查看本地狀態(tài)
git status
5.添加文件
git add .
6.輸入修改信息
git commit -m"吧啦吧啦吧啦"
7.提交前同步遠(yuǎn)程代碼
git pull
7.提交修改至遠(yuǎn)程
git push
分支操作
1.創(chuàng)建本地分支
$ git checkout -b dev
2.創(chuàng)建遠(yuǎn)程分支
$ git push origin dev:dev //前面是遠(yuǎn)程分支名 后面是本地分支名
3.刪除本地分支
$ git branch -D dev
4.刪除遠(yuǎn)程分支
$ git push origin --delete test
or
git push origin :test //推一個(gè)空分支 相當(dāng)于刪除
替換遠(yuǎn)程倉(cāng)庫(kù)地址
第一步
git remote -v #查看遠(yuǎn)端地址
git remote #查看遠(yuǎn)端倉(cāng)庫(kù)名
git remote set-url origin https://gitee.com/xx/xx.git (新地址)
第二步
git pull origin master --allow-unrelated-histories 強(qiáng)制合并 (可能會(huì)有沖突,手動(dòng)解決)
第三步
git add .
git commit -m"xxx"
git push
版本回退
git log
git reset --hard f496a9e3442ea660c10ae229c719d4e13e4ff70f