Skip to content

Instantly share code, notes, and snippets.

@oleiade
Created May 10, 2017 09:04
Show Gist options
  • Save oleiade/3e6102be06875c12ab74bac3ad21b510 to your computer and use it in GitHub Desktop.
Save oleiade/3e6102be06875c12ab74bac3ad21b510 to your computer and use it in GitHub Desktop.

Porcelain

Plumbing

# Check that there are no commit history/objects corrupted
$ git fsck --full --strict

# Get the tree hash a commit is pointing at
$ git rev-parse '6fea31^{tree}'

# Find the latest anotated tag before HEAD
$ git describe HEAD

# Find the latest tag (independant of anotation) before HEAD commit
$ git describe --tags HEAD

# Filter a git command results that has the provided words in them
$ git log/rev-parse/cat-file/... :/some words

# Apply a git command to a commit's version of a file
$ git mycommand REF : FILE
$ git show 4fda159b:myfile.txt

# In the scenario of a merge or rebase conflict, allows you to visualize
# the different conflicting versions of a file
$ git show :0:FILE  # Current staged file's content
$ git show :1:FILE  # Common ancestor file's content
$ git show :2:FILE  # Targets file's content
$ git show :3:FILE  # Mergigin in file's content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment