Fast merge merge in git

I will provide this by saying I'm pretty new to git. However, this seems like a pretty simple scenario, and I don’t see where this problem comes from. Here is the scenario:

I'm on the main branch with some uncommitted changes that I don't need. I need to make a separate simple change for packaging in a patch. So I do this:

I find the hash # for the last commit of the main branch, which is ffdd99afc89211e9ddc3efa3415b0adaf0076b4b.

So, from the root of my repository, I do:

git branch my_patch ffdd99afc89211e9ddc3efa3415b0adaf0076b4b
git checkout -f my_patch

Now I edit three files and add a fourth, after which I do:

git add [path to the added file]
git status

this list lists three updated and one added file

git commit -a
git status

no changes found

git format-patch master --stdout > my_patch.patch

Everything is good at this point. Now I want to merge this branch into a master.

git checkout master
git status

No changes found

git merge my_patch

Exit from which:

Updating ffdd99a..e2754ca 
error: Your local changes to 'Blah.cs' would be overwritten by merge. 
Aborting. Please, commit your changes
or stash them before you can merge.

, git status, . - -?

+3
1

, git reset --hard. , , git clean -df.

, ​​. Windows w/msysgit?

, , autocrlf false.

0

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


All Articles