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
相关推荐
Jditinpc4 小时前
Git使用
git
貂蝉空大6 小时前
Git 常用命令大全
git
兔斯基灬木木8 小时前
【技术工具】源码管理 - GIT工具
git
工呈士10 小时前
Git 工作流与版本管理策略
前端·git·面试
C++ 老炮儿的技术栈10 小时前
文本文件与二进制文件的区别
大数据·c语言·开发语言·c++·git·算法·visual studio
Jooolin14 小时前
【编程史】Gitee是啥?它和GitHub关系是什么?
git·github·ai编程
貂蝉空大15 小时前
Git Switch 与 Git Restore 详解
git
aini_lovee1 天前
python在容器内克隆拉取git私有仓库
git·python·elasticsearch
zhangphil1 天前
git merge合并分支push报错:Your branch is ahead of ‘xxx‘ by xx commits.
git
2018_XWJ1 天前
本地项目push到git
git