GIT 相关

git clone

git clone --branch   克隆指定分支
git clone --depth=1 克隆最近一次commit(减小体积)

base

git status
git config --global core.autocrlf input		签出不转换,lf一致
git config --global core.autocrlf true		push为lf,pull为crlf
git config --global core.quotepath false		中文文件名乱码
git config --list	配置项
git branch -a 查看分支
git reset --hard	版本退回
git checkout -b deployv2_k8s_1.10 origin/deployv2_k8s_1.10 切换分支
git push origin -d xxx 删除远程分支
git pull origin xxx	更新远程分支
git commit -m ""
git rm --cached xxx 删除已经add的文件

push code

git checkout -b hotfix
git branch --unset-upstream master
git branch --set-upstream-to=hotfix
git config --global user.email "xiongyungang@corp-ci.com"
git config --global user.name "xiongyungang"
git add xxx
git commit -m ""
git push [-f] origin hotfix

git push --set-upstream origin hotfix	(2)

push file or empty

git init
git add .
[git rm --cached xxx]
git commit -m ""
git remote add origin xxx
git push -u origin master

创建远程空分支

git checkout --orphan new_branch
git rm -rf .  ##删除当前仓库所有文件!!!
git add .
git commit -m ‘new branch’
git push origin new_branch

还原git rm 删除的文件

## git rm -rf /src
git reset HEAD src/
git checkout src
posted @ 2019-04-17 16:54  熊云港  阅读(130)  评论(0编辑  收藏  举报