Somehow my git branch has evolved into my lead branch

I use git -flow, but that doesn't matter. My leading industry is manufacturing, and my development branch is for development.

This morning my workshop (this is my graduation) has not touched me for several weeks (since my last graduation). Now, when I look at my lead branch, I have all my commits from my development branch.

I don't see a merge in git log , so I'm confused how I can get my master branch back to its boring self.

How can I find this gun merge with my main branch and undo it without losing my development work?

Edit:

Does this provide enough information to know what happened?

Here is the result of git reflog :

 0fe067c HEAD@ {0}: pull: Fast-forward 300ba32 HEAD@ {1}: checkout: moving from develop to master 06f1dd9 HEAD@ {2}: pull: Fast-forward 0fe067c HEAD@ {3}: commit: Add back prefix. 815ffe8 HEAD@ {4}: pull: Fast-forward f4c3e23 HEAD@ {5}: pull: Fast-forward 93d1037 HEAD@ {6}: pull: Fast-forward e027c53 HEAD@ {7}: commit: Don't commit changes to Prefix 96e37a9 HEAD@ {8}: commit: Update URLs based on current server 
+4
source share
2 answers

Well, if the merge was redirected quickly, it would not create the merge command, which probably happened.

So, from there, where are we going?

Well, if you have a remote object that still points to a good commit, you can easily reset to create a local branch:

git reset --hard origin/master (where remote/branch )

Otherwise, it’s a little more complicated, but still: you can filter your log to register only basic information:

git reflog show master

And if the logged information makes sense, you can reset:

git reset --hard master@ {1}

Please note that --hard will discard all local changes made in the working tree, if this is a problem, use --keep .

0
source

Did you mark your production branch when you let go?

Do you have any idea about sha1 latest release?

I like Simon Boudrias, but it can be as simple as finding the commit you want with git log and resetting the branch to that commit git reset --hard <sha1> .

Note. You might want to reset without the first part, to make sure that it will take you to the point you need without losing information.

 git co production git log # find the sha1 git reset <sha1> # to check if this is the point you want git co production git reset --hard <sha1> 

Since you do not remove the commit from the "development", you do not lose the commit (until no one develops directly in production).

0
source

Source: https://habr.com/ru/post/1435995/


All Articles