Git:使一个分支与另一个完全相同 [英] Git: Make one branch exactly like another

查看:274
本文介绍了Git:使一个分支与另一个完全相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Git相对较新,但对它仍然不太满意.现在,我正在寻找可以使当前分支看起来像另一个分支的命令/选项/魔术.也就是说,合并它们,但是当发生冲突时,请始终选择要合并到当前分支中的分支中的差异.

I am relatively new to Git, and I'm still not very comfortable with it. Right now, I'm looking for the command/options/magic that can make the current branch look like another branch; that is, to merge them, but when a conflict arises, to always choose the difference in the branch that is being merged into the current one.

我的处境就是这样;我在"master"分支上有一个稳定的(ish)应用程序.我还有另一个分支,称为功能".我基本上想对功能进行更改/添加/删除,直到我喜欢正在使用的新功能.感觉准备就绪后,我要使master分支看起来与feature分支相同.

My situation is thus; I have an stable(ish) application on the "master" branch. I also have another branch, called "feature". I basically want to make changes/additions/deletions to feature until I like the new feature I'm working on. Once I feel it is ready, I want to make the master branch look identical to the feature branch.

我知道这可能不是最佳做法,但是正如我所说,我是Git的新手.我计划将来学习如何做更复杂的事情,但是现在,这就是我所需要的.

I know this probably isn't a best practice, but as I said, I'm new to Git. I plan on learning how to do more complicated things in the future, but for now, this is all I need.

谢谢!

推荐答案

分支只是提交图中的指针.您可以git-reset分支指向您喜欢的任何地方,只需确保在进行任何进一步的提交之前签出了预期的分支即可.

Branches are just pointers within the graph of commits. You can git-reset a branch to point to anywhere you like, just make sure you checkout the intended branch before making any further commits.

这篇关于Git:使一个分支与另一个完全相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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