Why doesn't git format-patch for bookmarks work?

If I run

git format-patch -1 stash@{0}

git automatically returns without creating a file. Why is this happening? How to save the save in a compatible format git am?

+3
source share
4 answers

This is apparently due to the fact that the stash commit is represented as a merge (between its parent and indexing state at that time), and format-patchdoes nothing in the merge transaction.

If you say

git format-patch stash@{0}{,^}

then he will spit out patches between the cache and each parent.

To illustrate, it looks like:

*   99aedb8 (refs/stash) WIP on master: 668ff36 initial commit
|\  
| * 6b8d77f index on master: 668ff36 initial commit
|/  
* 668ff36 (HEAD, master) initial commit
+4
source

You can try

git stash show -p > ~/Desktop/stash.patch

This will create a patch file on your desktop for the last patch and source parent.

git -stash show

+1

.

1. . , , .

2: .

git format-patch 'stash@{0}^1'..'stash@{0}^2'

HEAD ( stash).

, , , git format-patch 'stash@{0}^1'..'stash@{0}'

. - stash. 2- ( ), .

Miscellaneous: It git format-patch -1will always be empty for fixing the merge (stashes is a special case of merging). I don’t quite understand why this is so, but see Git: how to create patches for merging? for more details.

0
source

If your files are hidden with git stash -u, then it git stash show -pdoesn’t work

-1
source

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


All Articles