Skip to content

Instantly share code, notes, and snippets.

View OSX mount drive over ssh with FUSE
sshfs username@hostname:/remote/directory/path /local/mount/point -ovolname=NAME
dearaujoj / delete-local-and-remote-tags
Created Nov 17, 2014
delete local and remote Git tags programatically
View delete-local-and-remote-tags
#check tag with specific value
for i in 2013 ; do git tag -l | grep "$i" ; git ls-remote --tags origin | awk '{print ":"$2}' | grep "$i" | grep -v '{}' ; done
#delete local and remote tag with specific value
for i in 2013 ; do git tag -l | grep "$i" | xargs git tag -d ; git ls-remote --tags origin | awk '{print ":"$2}' | grep "$i" | grep -v '{}' | xargs git push origin ; done
dearaujoj / gist:2f53b9e34869e9787b2c
Created Oct 27, 2014
How to list files sorted by modification date recursively
View gist:2f53b9e34869e9787b2c
#Change 1n,1 to 1nr,1 if you want the files listed most recent first.
find . -printf '%T@ %c %p\n' | sort -k 1n,1 -k 7 | cut -d' ' -f2-
View gist:a410ab457a70a4bb9367
# add to .gitconfig
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
dearaujoj /
Created Oct 30, 2013
Find differences between two branches
MASTER=`git log --pretty=format:'%H' develop | sort`
DEV=`git log --pretty=format:'%H' new_develop | sort`
for i in `diff <(echo "${MASTER}") <(echo "${DEV}") | grep '^>' | sed 's/^> //'`;
git --no-pager log -1 --oneline $i;
dearaujoj / remove_git_tag
Created Oct 22, 2013
git remove tag locally and remote
View remove_git_tag
git tag -d TagName && git push origin :refs/tags/TagName
dearaujoj / MemoryAll
Created Oct 17, 2013
Total amount of memory used by the various process running on Linux
View MemoryAll
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | awk '{total=total + $1} END {print total}'
dearaujoj / gist:5661536
Created May 28, 2013
Push a local branch to a different remote branch
View gist:5661536
git push remote local_branch:remote_branch
View OSX commands
#Remove files from quarantine recursively
xattr -d -r ./Folder
View git-clean.txt
remove files git clean -f
remove directories, run git clean -f -d.
remove ignored files, run git clean -f -X.
remove ignored as well as non-ignored files, run git clean -f -x.
Note the case difference on the X for the two latter commands.
Unless you specify -f and clean.requireForce is set to "true" (the default) in your configuration, nothing will actually happen, with a recent enough version of git.
You can’t perform that action at this time.