简体   繁体   English

如何在git中重新设置基准?

[英]How do I rebase in git?

Can anyone please help me out doing a rebase on git? 谁能帮我做一个基于git的基础吗? It's really confusing, I'm not able to understand its functionality. 这确实令人困惑,我无法理解其功能。 I want to rebase branch on master origin. 我想基于主源重新设置分支。

How do I do that? 我怎么做? I also want to squash commits into one. 我也想将提交压缩为一个。

Take a look at the manual here . 这里看看手册。

Swith on your branch: 在您的分支机构上切换:

 git checkout myBranch

Rebase it on your master: 将其基于您的母版:

 git rebase master

If you want to squash some commits (for example on the last 10 commits) you've do an interactive rebase while you're on your branch: 如果您要压缩某些提交(例如最近的10次提交),则可以在分支机构上进行交互式变基:

git rebase -i HEAD~10

Then in your editor you can use the squash keyword to meld a commit in it previous commit. 然后,在编辑器中,您可以使用squash关键字将一个提交与之前的提交进行融合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM