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
相关推荐
刺客xs4 小时前
git 入门常用命令
大数据·git·elasticsearch
LostSpeed5 小时前
git - github工程中不能包含大文件
git·github
pzx_0015 小时前
【GIT】删除远程文件
git
小白_ysf6 小时前
Git 命令操作完整指南(实际工作中常用命令)
git·代码上传
HealthScience6 小时前
怎么使用git下载huggingface的文件
git
huangjiazhi_6 小时前
git clone next InitializeSecurityContext failed错误
git
_oP_i8 小时前
git gui设置github sshkey
git·github
ergevv8 小时前
Git 子模块(Submodule)操作指南
git·子模块·submodule
阿拉伯柠檬9 小时前
Git原理与使用(一)
大数据·linux·git·elasticsearch·面试
chao_78910 小时前
双设备全栈开发最佳实践[mac系统]
git·python·macos·docker·vue·全栈