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
相关推荐
HAPPY酷3 小时前
git配置及使用
git
sg_knight3 小时前
IntelliJ IDEA 实用插件:GitToolBox 使用指南
java·ide·git·intellij-idea·插件·gittoolbox
青靴5 小时前
Git Hooks 实现 CI/CD 进阶实践 -- 根据实际需求添加功能
git·elasticsearch·ci/cd
LiuYaoheng5 小时前
Git配置SSH Key到GitHub的详细教程
git·ssh·github
x***B4116 小时前
Git数据分析实战
git·数据挖掘·数据分析
健康平安的活着8 小时前
gitflow的实战操作案例【经典实操】
git
1***s63210 小时前
Git混合现实开发
git·mr
q***R30811 小时前
Git日志
git
草莓熊Lotso12 小时前
Git 本地操作进阶:版本回退、撤销修改与文件删除全攻略
java·javascript·c++·人工智能·git·python·网络协议