Skip to content

Instantly share code, notes, and snippets.

@rednebmas
Last active August 10, 2016 15:05
Show Gist options
  • Select an option

  • Save rednebmas/05f8820229bd775400d8f446ed4836c9 to your computer and use it in GitHub Desktop.

Select an option

Save rednebmas/05f8820229bd775400d8f446ed4836c9 to your computer and use it in GitHub Desktop.
Useful and common bash commands
#########
## Git ##
#########
# search diff of dangling commits for the word AVCaptureDevice
git fsck --no-reflog | awk '/dangling commit/ {print $3}' | \
while read ref; do if [ "`git show -p $ref|grep -c AVCaptureDevice`" -ne 0 ]; then echo $ref ; fi ; done
# list git commit messages for dangling commits
git fsck --lost-found | grep "dangling commit" | cut -d" " -f 3 | xargs -I "{}" git show --stat "{}" # view git messages for dangling commits
# recursive find and replace without corrupting git index
grep -r -l --exclude-dir=.git 'OUPAlbumSelectNavItemViewController' . | sort | uniq | xargs perl -e "s/OUPAlbumSelectNavItemViewController/OUPPhotoAlbumSelectNavItemViewController/" -pi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment