1、克隆遠程分支到本地
git clone xxxx.git
2、查看當前 tree 狀態
git status
3、查看當前分支
git branch
4、如果遠程有某個分支A而本地沒有,可以先更新遠程分支列表到本地
git fetch
5、切換分支
git checkout <branch>
6、文件提交到暫存區
git add . // 提交所有
git add 1.txt //提交1.txt文件
7、文件提交
git commit –m “這裏是提交的備註”
8、推送更改到遠程
git push
9、合併兩個分支,比如 A 合併 B,先切換到分支 A,然後
git merge B
10、查看分支列表
git branch –a
這個可能和遠程分支不一致,可以用上面提過的 git fetch 進行更新
11、合併其它分支的某個文件到當前分支
git checkout <branch> <filename> <filename>
12、查看某個文件提交記錄
git log <file>
13、恢復某個文件到指定版本
git checkout <hash> <filename>
git reset xxxxxx
git push -u origin Branch_FE_Ocp_UAT -f
git branch -d xx 本地
git push origin <branch> --delete