Then turn out of the next comme.Detailed information on the issue https://ru.stackoverflow.com/q/431520/181472 ♪ Shortly, when you fix it, you can just move into the right comedian or even create a new branch.Remove the changes from the project,That'll be the whole answer.The most important question is:Have you managed to intimidate this branch on a remote repository? Is it possible that another developer has already received a remote repository of comemite B or one of the following, and continues to work on it. If the answer is yes, in general, it is desirable. revertbut not rebase, cherry-pick, and other things that rewrite Git's story, as it creates https://ru.stackoverflow.com/q/429512/181472 ♪ Since you need to move out of C that does not contain changes from B, it's almost certainly necessary to write a story. In that case, alert the colleagues in advance. They're going to have to rebate their changes in the same way, for example, with the commite. D ♪ D'♪We'll set the initial situation on the following pattern:A - B - C - D
↑
branchname
(HEAD)
A♪ B♪ C♪ D - the switches in the branch. branchname♪ B - The bad comedian, we need to remove it. Commmit C We need to lock up.
(HEAD) - The location of the HEAD indicator.↑ Describes the committee to which a certain branch or index indicates.Option 1 - through rebase -iPlus, less trash in history. And you can be proud to learn rebase.Plus, it is possible to move from C that does not contain changes from B.Minus is rewriting history, dangerous in command.Teams:git checkout branchname
git rebase -i A
git checkout -b deployme C'
As A, we point a comemite right before we rule out. A's still in place. The editor's gonna open up, he'll have the commites back. Change pick ♪ dropthat we want to throw that comedian out.drop 323d4e6 comment for B
pick 31da2b9 comment for C
pick 24d420c comment for D
Rebase c8893f9..24d420c onto c8893f9 (3 command(s))
Commands:
p, pick = use commit
r, reword = use commit, but edit the commit message
e, edit = use commit, but stop for amending
s, squash = use commit, but meld into previous commit
f, fixup = like "squash", but discard this commit's log message
x, exec = run command (the rest of the line) using shell
d, drop = remove commit
OutcomeA - C' - D'
↑
branchname
(HEAD)
↑
deployme
(HEAD)
New committs now have another ancestor, so it's other, new commites (although the contents are the same less B). New branch deployme looking at the comedian. C'♪Option 2 - through revertPlus, he doesn't rewrite history, and he's safe with teamwork. More than rebase.Minus is the wrong comedian staying in history. It's bad if there's information that you can't show or a code that's embarrassed to publish. :Minus - Committ C continue to contain changes from B♪Teams:git checkout branchname
git revert B
Result:A - B - C - D - xB
↑
branchname
(HEAD)
New comedy. xB contains changes that eliminate changes in the text. B♪ But we have a problem: C still contains changes from B♪A little more detailed revert: https://git-scm.com/docs/git-revert https://ru.stackoverflow.com/a/431521/181472 ♪In addition:If there's a mistake in the process or you lose the wrong comedy: https://ru.stackoverflow.com/q/232455/181472 But if you want, you can do something with other comedians: https://ru.stackoverflow.com/q/416761/181472 ♪