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
相关推荐
满天星83035778 小时前
【Git】原理及使用(七) (多人协作 [下])
git
郡杰14 小时前
Git基础与开发平台搭建
git·后端
钟智强16 小时前
我警告了 329 天
git·php·wordpress·webshell
乐观的冷风18 小时前
我们需要将文件添加到暂存区才能提交,而移除文件后是无法添加到暂存区的,那么怎么移除一个文件让GIT不再将其纳入版本控制呢?上图中GIT已经给出了说明:
git
tjl521314_2119 小时前
Git SSH Host Key Verification Failed 问题排查与解决
运维·git·ssh
嘶哈哈哈21 小时前
[特殊字符] Git 协作指南
git
say_fall21 小时前
【Git 精品详解】企业规范:企业级开发模型、Git Flow、发版流程规范、Code Owner 制度、事故应急回滚
大数据·linux·服务器·git·学习·elasticsearch
江畔柳前堤2 天前
第13章:docker生产环境部署实战
运维·git·docker·容器·代码复审
GuHenryCheng2 天前
【ESP32】ESP-IDF开发环境搭建(cursor)
git·stm32·单片机·学习
kaka。。2 天前
GIT安装+代码推送
git