Git用分支覆盖主人 [英] Git Overwrite master with branch

查看:153
本文介绍了Git用分支覆盖主人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在改变它之后用特定的分支覆盖master,我做的是这样做的:

第1步:从Git结账brranch,使用命令:

  git checkout branch_name 

第2步:我对代码做了一些更改,现在我想将此分支作为主分支,因为我首先运行以下命令:

  git status 

上面的命令列出了所有修改过的文件。



现在我的问题是,我需要用这个特殊的分支my_branch来做这些事情吗?

code> git branch -f master dev_branch 会重写本地master分支。



git push remote + dev_branch:master 会重写远程分支。


I want to overrite master with a particular branch after making changes to it, what I done to do it is:

Step 1: Checkout brranch from Git, using command :

git checkout branch_name

Step 2: I done some changes in code, now I want to make this branch as master, for that I first run the command:

git status

Above command list me all the modified files.

Now my question, what all I need to do overrite master with this particular branch "my_branch"?

解决方案

git branch -f master dev_branch will rewrite local master branch.

git push remote +dev_branch:master will rewrite remote branch.

这篇关于Git用分支覆盖主人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆