Git Cheatsheet

  • git rev-parse --show-toplevel prints out the root directory of the repo
  • git restore -p <file> can restore chunks selectively and will ask you whether or not to revert each chunk.
  • git add -p <file> does the same, but for adding

Thanks for reading! If you have any questions or comments, please send me a note on Twitter.

Please also consider subscribing to my weekly-ish newsletter, where I write short essays, announce new articles, and share other interesting things I've found.