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
相关推荐
小皮侠5 小时前
nginx的使用
java·运维·服务器·前端·git·nginx·github
HalukiSan6 小时前
如何提交PR
git·gitlab·github
爱莉希雅&&&17 小时前
shell编程之awk命令详解
linux·服务器·git
baiyu3317 小时前
成为git砖家(12): 看懂git合并分支时冲突提示符
git
wu_aceo21 小时前
将本地项目提交到Gitee
git·gitee·提交·本地提交·上传git
随便取个六字1 天前
GIT操作 学习
git·学习
星源~2 天前
tree 命令集成到 Git Bash:可视化目录结构的指南
git·单片机·物联网·嵌入式·项目开发
zhaqonianzhu2 天前
git gerrit安装钩子
git·gerrit
这是个栗子2 天前
【问题解决】VSCode终端中看不到Git-Bash
ide·git·vscode
悲伤小伞2 天前
linux_git的使用
linux·c语言·c++·git