User Tools

Site Tools


git_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git_cheat_sheet [2026/05/10 07:59] stephengit_cheat_sheet [2026/05/19 22:30] (current) – [Try Git] stephen
Line 157: Line 157:
 | ''<nowiki>git push --force origin HEAD~10:$(git rev-parse --abbrev-ref HEAD)</nowiki>'' | Force push up to the last 10 commits. | | ''<nowiki>git push --force origin HEAD~10:$(git rev-parse --abbrev-ref HEAD)</nowiki>'' | Force push up to the last 10 commits. |
 | ''<nowiki>gitk</nowiki>'' | A commit viewer. | | ''<nowiki>gitk</nowiki>'' | A commit viewer. |
-| ''<nowiki>gitk 'stash@{0}'</nowiki>'' | View the contents of the first stash. | 
 | ''<nowiki>gitk --all $(git fsck --no-reflog | Select-String "(dangling commit )(.*)" | %{ $_.Line.Split(' ')[2] })</nowiki>'' | Find a dropped stash. | | ''<nowiki>gitk --all $(git fsck --no-reflog | Select-String "(dangling commit )(.*)" | %{ $_.Line.Split(' ')[2] })</nowiki>'' | Find a dropped stash. |
 | ''<nowiki>git tag -a <tagname> -m "commit comment"</nowiki>'' | Annotated tag (preferred over lightweight tags). | | ''<nowiki>git tag -a <tagname> -m "commit comment"</nowiki>'' | Annotated tag (preferred over lightweight tags). |
Line 166: Line 165:
 | ''<nowiki>git --git-dir=../<other repo>/.git format-patch -k -1 --stdout <commit hash> | git am -3 -k</nowiki>'' | 'Cherry pick' a commit from another repo. | | ''<nowiki>git --git-dir=../<other repo>/.git format-patch -k -1 --stdout <commit hash> | git am -3 -k</nowiki>'' | 'Cherry pick' a commit from another repo. |
 | ''<nowiki>git remote -v</nowiki>'' | View remote / origin URL. | | ''<nowiki>git remote -v</nowiki>'' | View remote / origin URL. |
 +|  Stashing  | |
 +| ''<nowiki>gitk 'stash@{0}'</nowiki>'' | View the contents of the first stash. |
 +| ''<nowiki>git diff stash</nowiki>'' | Shows differences between your current working tree and the most recent stash entry. |
 +| ''<nowiki>git diff stash@{0}</nowiki>'' | Shows differences against a specific stash entry (here, the latest one explicitly). |
 +| ''<nowiki>git diff --name-only stash</nowiki>'' | Lists only file names that differ between your working tree and the stash. |
 +| ''<nowiki>git diff stash -- path/to/file.cs</nowiki>'' | Shows differences against the stash for only the specified file. |
 +
 +
 +
  
 ===== Workflows ===== ===== Workflows =====
git_cheat_sheet.1778399951.txt.gz · Last modified: 2026/05/10 07:59 by stephen

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki