git新建分支和合并fork分支

git新建分支和合并fork分支

1.新建和删除分支

javascript 复制代码
git checkout --orphan emptybranch
git rm -rf .
echo '# new branch' >> README.md
git add README.md
git commit -m 'new branch'
git push origin emptybranch

2.回滚代码

javascript 复制代码
git reset --hard 目标版本号"
git push -f

3.合并分支

javascript 复制代码
git remote add upstream <原仓库git地址>
git fetch upstream
git merge origin2/master --allow-unrelated-histories

4.删除分支

javascript 复制代码
git checkout <another_branch>
git branch -d <branch_name>
git branch -D <branch_name>
git push <remote_name> --delete <branch_name>

5.仓库迁移

javascript 复制代码
git clone --bare ssh://url
cd xxx-ui.git/
git push --mirror ssh://url
相关推荐
为祖国添砖爪哇10 分钟前
【Git原理与使用】多人协作与开发模型(2)
git
memories19828 分钟前
git使用方法详解(适合新手)
git
为祖国添砖爪哇1 小时前
【Git原理与使用】版本管理与分支管理(1)
git
GoppViper3 小时前
golang学习笔记29——golang 中如何将 GitHub 最新提交的版本设置为 v1.0.0
笔记·git·后端·学习·golang·github·源代码管理
m0_464832365 小时前
Linux服务器上安装git lfs命令
git
贩卖纯净水.12 小时前
白月光git
git·github
爱吃瓜的猹z16 小时前
git reset 几点疑问
git·源代码管理
悟空20161 天前
001、Git开发流程规范
git
Li小李同学Li1 天前
git学习【持续更新中。。。】
git·学习·elasticsearch
晨春计1 天前
【git】
android·linux·git