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
相关推荐
Vermouth_0016 小时前
git clone的时候提示access denied
git
qq_4376572718 小时前
清楚本地的git并重新登录
git
jiang_changsheng18 小时前
工作流agent汇总分析 2
java·人工智能·git·python·机器学习·github·语音识别
顶点多余18 小时前
版本控制器-git
linux·git
夔曦19 小时前
Git工程日常下拉/上传完整流程(自用)
git
岱宗夫up19 小时前
GitHub Desktop如何设置中文?这不是个简单问题
git·github
岱宗夫up1 天前
.env 文件是干啥的?为什么不能提交到 Git?
大数据·git·elasticsearch·搜索引擎·gitee·github·gitcode
家里有只小肥猫1 天前
git回退某条/多条提交记录
git
何中应2 天前
IDEA 中让 Git 忽略 .idea 目录
java·git·intellij-idea
小柯博客2 天前
从零开始打造 OpenSTLinux 6.6 Yocto 系统 - STM32MP2(基于STM32CubeMX)(六)
c语言·git·stm32·单片机·嵌入式硬件·开源·yocto