Skip to content

Instantly share code, notes, and snippets.

@Eomm
Last active January 24, 2021 12:44
Show Gist options
  • Save Eomm/75999440b00d5579fd34c6c261b08e32 to your computer and use it in GitHub Desktop.
Save Eomm/75999440b00d5579fd34c6c261b08e32 to your computer and use it in GitHub Desktop.
GIT Magic
// Review a GitHub Pull Request ID
git fetch origin pull/ID/head:foo
git checkout foo
// View all your stashes, also which you have deleted!
git fsck --unreachable | grep commit | cut -d ' ' -f3 | xargs git log --merges --no-walk
// Restore a deleted stash
git update-ref refs/stash da02442ffa1584b489dc37a0fcf70fb1b60d9d2c -m "Piuf no one is lost"
// Last tag
git describe --tags $(git rev-list --tags --max-count=1)
// Search tags
git tag --format='%(objectname) %(refname:strip=2)' --sort=-version:refname -l v1*
// Search logs between commit
git log --pretty=oneline HEAD...<commit id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment