How to check the source code of hidden files without pasting them into git?

I have hidden files in git, but I donโ€™t want it to git stash pop , because once it displays a merge message, I donโ€™t want to merge to see the source code in the files with saving, is there a way to do this?

+4
source share
2 answers

Assuming you want to get the last saved record,

 git show stash@ {0}:pathname 

Two aspects of this syntax are explained on the corresponding manual pages:

  • The description of <rev>:<path> is explained on the gitrevisions(7) page (think about it in full), it will teach you certain convenient things to use later).
  • The syntax stash@ {<n>} for accessing the entries will be described on the git-stash(1) page.
+6
source

To return the hidden code without removing it from the list, you can use

 git stash apply 

to restore the last hidden code, but I believe that you just want to see diff, you can use

 git diff stash@ {0} 

which is a simple command to break the stored code in the first position .

Using git stash list , you can take a look at the position that the saved code that you want to see exists, and then run git diff stash@ {position} with the correct position .


EDIT :

As indicated in the comments, there is another command that can help, if you want to see the whole file in the saved code, you can create a branch with the saved code and view it using the following command

 git stash branch <branchname> [<stash>] 
+3
source

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


All Articles