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
相关推荐
天地人-神君2 小时前
将.idea取消git托管
java·git·intellij-idea
Zach_yuan6 小时前
版本控制器Git
linux·git
唐青枫11 小时前
Git 提交时神秘的 create mode 100644 到底是什么?一文告诉你答案!
git
春生野草12 小时前
Git-git stash与分支管理
git
ljh57464911912 小时前
Git合并冲突解决方法
git
悟能不能悟12 小时前
git revert commit和undo commit的区别
git
222you1 天前
Git的diff命令
git
补三补四1 天前
Git 基础操作指南
大数据·git·elasticsearch
222you1 天前
git的命令
git
Coolbike1 天前
Git工作流
git