Pulling the branch from the source merged it into my local branch, and I need to get it back

I was working on a local branch, and I needed to tear down one of the branches from the source, so I issued the following command:

git traction original design

When I did this, this branch was merged into my current local branch, which is not at all what I wanted. So I need to do 2 things:

  • How to return this merge from my local branch?
  • How to pull a branch from a source without doing this merge?
+4
source share
1 answer

To undo a merge commit created using pull :

 git reset --hard HEAD^ 

If the merge was a fast merge (this means that you did not do any work locally), then git reset --hard in sha1 of the last commit that you want to save locally.

To get a remote branch without merging:

 git fetch origin 

The remote branch will appear something like origin/master (with git branch -a ).

+7
source

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


All Articles