G
G
grabbee2016-10-17 15:00:53
git
grabbee, 2016-10-17 15:00:53

How to push changes in master to a separate branch in git?

By mistake, I started coding a new feature in the master branch, and I couldn’t stop :) Now everything is very confused, I wanted to return to the starting point, and all that after that commit should be separated into a separate branch, not the master branch, but the master should continue from that point. Is that possible? Please tell me how to do it

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Moseychuk, 2016-10-17
@grabbee

git branch feature_branch- create a branch with a feature
git reset --hard commit_hash- reset the current branch (in your case it should be master) to the selected commit.
Well, then force push, etc.
If you are not alone working on a project, then such actions must be coordinated with the rest.

M
Michael, 2016-10-17
@springimport

Before any action, I advise you to copy everything, in the case of git, this is really important :)
Try moving the commits like this .

I
iBird Rose, 2016-10-17
@iiiBird

copy everything that is in the folder where the thread. roll back everything you wanted - manually return what you did. you can fire on your commits.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question