简体   繁体   English

使用主内容回滚开发分支中的更改

[英]Rolling back changes in develop branch with the master content

I made a mess in the develop branch and now I want to rollback to the content of the master branch, how can I do that? 我在develop分支中一团糟,现在我想回滚到master分支的内容,我该怎么做?

* develop
  master

After the git branch command. git branch命令之后。

Branches in git are just labels pointing at commits. git中的分支只是指向提交的标签。 They're cheap and easy to move around. 它们很便宜并且易于移动。 Your repository looks like this. 您的存储库如下所示。

A - B - C - D [master] - E - F - G [develop]

You want it to look like this. 您希望它看起来像这样。

A - B - C - D [master] [develop]

There's several ways to accomplish this. 有几种方法可以做到这一点。 One is to delete develop and remake it. 一种是删除开发并重新制作。

  1. git checkout master
  2. git branch -d develop
  3. git checkout -b develop

Another effectively does the same thing, but it moves develop in one command. 另一个有效地执行相同的操作,但是它在一个命令中移动开发。

  1. git checkout master
  2. git branch -f develop
  3. git checkout develop

I have branch -f aliased to rebranch . 我将branch -f别名为rebranch

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

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