常用操作
1、 git status 查看倉庫狀態
2、 git add 文件名 把文件添加到倉庫
3、 git commit -m 把文件提交到倉庫 -m后跟說明
4、 git add -A 提交當前目錄下多個文件
5、 git rm 文件名 刪除版本庫文件
6、 git rm --cached 文件名 刪除暫存區文件,工作區文件還在
7、 git remote -v 查看詳細地址
8、 git diff 文件名 查看修改的內容
9、 git log --pretty=oneline 查看日志
10、git reset --hard 版本號 穿梭版本
11、git config --system --list 查看系統config
12、git config --global --list 查看當前用戶(global)配置
13、git config --global user.name '' 查看當前用戶名字
14、git config --global user.email '' 查看當前用戶郵箱
15、git config --global user.name '' "xxxx" 修改當前用戶名字
15、git config --global user.email '' "xxxx@.xxxx" 修改當前用戶郵箱
分支操作
1、git branch 查看分支
2、git branch 名字 創建分支
3、git checkout 名字 切換分支
4、git merge 名字 合並分支(切換到主干上合並分支)
5、git branch -d <name> 刪除分支
6、git checkout -b <name>或者git switch -c <name> 創建+切換分支
7、git switch 分支名
切換已有分支
8、git switch -c dev
創建並切換到新的dev
分支
遠程操作
1、git remote 查看遠程倉庫
2、git remote -v 查看倉庫地址
3、git remote remove <遠程庫名> 刪除遠程倉庫
4、git remote rename <舊名稱> <新名稱> 修改遠程倉庫名稱
5、git pull origin master 拉代碼
6、git remote rm 遠程庫名 刪除指定的遠程庫
7、git remote add origin 添加遠程倉庫
8、git clone 從遠程倉庫克隆項目
注:想要提交到指定的碼雲上,不管是在主干或者是分支上,都需要先拉一下,然后再提交,拉誰就提交誰