删除本地分支
git branch -D test –没合并也删除
git branch -d test — 没合并删除不了
删除远程分支
git push origin :feature/ttkh
查看本地分支:git branch
查看远程分支:git branch -r
查看所有分支:git branch -a
切换远程分支:git checkout -b myRelease origin/Release
git remote add origin https://github.com/wu347771769/learngit.git
把某历史版本打出分支
git checkout -b xxx/xxx 5f4648474fb38c75b69dce0db9c4d4ec1b1e6b74
合并到master分支:
git checkout master
git merge issue1234
把本地分支推送到远程分支
新建远程分支前端 CSS.md
git push origin hotfix/liyan-190905:hotfix/liyan-190905
远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch
git push -u origin/remote_branch
远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch
git push
处理更新不下来,分支冲突的情况
[www@xxx]$ git pull
error: ‘refs/remotes/origin/hotfix’ exists; cannot create ‘refs/remotes/origin/hotfix/business-button’
From gitlab.xxxx.com:Project/backend/gocashback-api
! [new branch] hotfix/business-button -> origin/hotfix/business-button (unable to update local ref)
error: some local refs could not be updated; try running
‘git remote prune origin’ to remove any old, conflicting branches
[www@xxxt]$ git remote prune origin
Pruning origin
指定本地分支和远程某个分支的关系
git branch –set-upstream-to=origin/branch_remote branch_local
查看本地的分支是和哪个远程分支关联的
git branch -vv
提交错误后,回滚
https://blog.csdn.net/BigData_Mining/article/details/88179370