How printing works in git internals

Where can I find out how git stashing works internally? I am interested in a detailed explanation similar to what is described in git objects in 9.2 git Internals - git Objects git -scm.

EDIT: I am updating my question based on the information I received from this link . Is my logic below correct?
HEAD is on branch br1. The last commit of 'br1-c0' on this branch had the following tree:

somefile.txt (the text inside is "some text") anotherfile.txt

I modified the somefile.txt file to “update text” as text inside. I am changing the changes:

1) one commit is created that has the following tree: somefile.txt (the text inside is “updated text”) anotherfile.txt And it has a link to commit 'br1-c0' and the file index state.

2) the working tree returns to commit 'br1-c0'.

+4
source share
1 answer

Git - open source code;) (or google)

In any case, stashes is a list of commits. You can see how they are created by creating a cover:

# git stash --keep-index # git stash list stash@ {0}: WIP on master: dafe337 sss # git log ' stash@ {0}' | cat commit 7f86a90fb4e57590d6fe5026b7408306a757132a Merge: dafe337 2881ede Author: Maciej Piechotka < uzytkownik2@gmail.com > Date: Fri Aug 30 09:27:10 2013 +0200 WIP on master: dafe337 sss commit 2881ede55d619570a82bb7312257c4e43bd3b334 Author: Maciej Piechotka < uzytkownik2@gmail.com > Date: Fri Aug 30 09:27:10 2013 +0200 index on master: dafe337 sss commit dafe33716c2e5aee994612c88d8142f1163c624e Author: Maciej Piechotka < uzytkownik2@gmail.com > Date: Fri Aug 30 09:25:40 2013 +0200 sss 

Sss is the first commit (HEAD), while the other two commits are the preservation of the current index (incremental changes), and the merge contains unspecified changes:

 % git show 2881ede55d619570a82bb7312257c4e43bd3b334 commit 2881ede55d619570a82bb7312257c4e43bd3b334 Author: Maciej Piechotka < uzytkownik2@gmail.com > Date: Fri Aug 30 09:27:10 2013 +0200 index on master: dafe337 sss diff --git a/test.cb/test.c index b9a1dd0..7beafd5 100644 --- a/test.c +++ b/test.c @@ -1 +1,2 @@ dddd +fff % git show 7f86a90fb4e57590d6fe5026b7408306a757132a commit 7f86a90fb4e57590d6fe5026b7408306a757132a Merge: dafe337 2881ede Author: Maciej Piechotka < uzytkownik2@gmail.com > Date: Fri Aug 30 09:27:10 2013 +0200 WIP on master: dafe337 sss diff --cc test.c index b9a1dd0,7beafd5..551a609 --- a/test.c +++ b/test.c @@@ -1,1 -1,2 +1,3 @@@ dddd + fff ++ggg 

Now the bookmark list is an existing structure - reflog (nb is a useful structure in itself ), and the name is ... stash. Thus, stashes are implemented de facto as a branch with a moving head, and we are interested in reflog. To make it more interesting, I created a second cache that created commit 0dee308c461955e13a864c9a904a69d611e82730 .

 % git reflog stash | cat 7f86a90 stash@ {0}: WIP on master: dafe337 sss % cat .git/refs/stash 0dee308c461955e13a864c9a904a69d611e82730 % cat .git/logs/refs/stash 0000000000000000000000000000000000000000 7f86a90fb4e57590d6fe5026b7408306a757132a Maciej Piechotka < uzytkownik2@gmail.com > 1377847630 +0200 WIP on master: dafe337 sss 7f86a90fb4e57590d6fe5026b7408306a757132a 0dee308c461955e13a864c9a904a69d611e82730 Maciej Piechotka < uzytkownik2@gmail.com > 1377847983 +0200 WIP on master: dafe337 sss 
+4
source

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


All Articles