Skip to content

Instantly share code, notes, and snippets.

sshfs username@hostname:/remote/directory/path /local/mount/point -ovolname=NAME
@dearaujoj
dearaujoj / delete-local-and-remote-tags
Created November 17, 2014 13:33
delete local and remote Git tags programatically
#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
#credits http://anavarre.net/2014/01/07/delete-local-and-remote-git-tags-programatically
@dearaujoj
dearaujoj / gist:2f53b9e34869e9787b2c
Created October 27, 2014 16:47
How to list files sorted by modification date recursively
#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-
# add to .gitconfig
[alias]
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
dearaujoj / diff_branch.sh
Created October 30, 2013 18:14
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/^> //'`;
do
git --no-pager log -1 --oneline $i;
done
@dearaujoj
dearaujoj / remove_git_tag
Created October 22, 2013 10:02
git remove tag locally and remote
git tag -d TagName && git push origin :refs/tags/TagName
@dearaujoj
dearaujoj / MemoryAll
Created October 17, 2013 08:41
Total amount of memory used by the various process running on Linux
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
dearaujoj / gist:5661536
Created May 28, 2013 09:12
Push a local branch to a different remote branch
git push remote local_branch:remote_branch
#Remove files from quarantine recursively
xattr -d -r com.apple.quarantine ./Folder
@dearaujoj
dearaujoj / git-clean.txt
Created December 3, 2012 11:14
git clean command
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.