Skip to content

Instantly share code, notes, and snippets.

@Nek
Last active December 21, 2017 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nek/a4208fe84fdde17e85be209d3fc96ff2 to your computer and use it in GitHub Desktop.
Save Nek/a4208fe84fdde17e85be209d3fc96ff2 to your computer and use it in GitHub Desktop.
Shell tricks

Files changed in current branch relatively to some other branch:

git checkout <notMainDev>
git diff --name-only <mainDev>

Take .js and .jsx file names from log and feed them to prettier rewiting them with output:

grep --regexp='\.jsx*$' log | xargs -I file prettier file --write

List local branches ordered by most recent commit:

git branch --sort=-committerdate  # DESC
git branch --sort=committerdate  # ASC

A very useful Git command to clean everything untracked:

git clean -xdf 

Find commits that add or remove particular string:

git log -S <string> path/to/file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment