Showing posts from 2016

Git rebase without conflicts

If you worked on a branch and have difficulties to rebase it from another branch (like master), you can you use Git automatic conflicts resolution strategy which prioritize files in conflict from your branch or from the branch you need to rebase from.

So, let's go. Consider you're on your branch (git checkout my_branch). You have a local branch 'master' you want to rebase from because master is up-to-date  and you want to retrieve last bug fxes and features from it.

If you want to prioritize your files in case of conflict, do :
git rebase master -Xtheirs

If you want to prioritize files from 'master' branch in case of conflict, do :
git rebase master -Xours

Hope this helps!

Reduce PDF size

You have a very large PDF file with high definition photos. It could be difficult to host on a server. So, to reduce its weight (and its quality of course), you can use ghostscript like this :

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.6 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
Of course this suppose you use Linux. 

A great post on REST API

How to force java path in subscript (nested script call)

If you use a script that runs another script which starts a java virtual machine, you should need to specify which java command you want to use from the first script. Consider the following example :  ---> --> java command
I can modify but not which calls java command. But I need a specify version a java.

So, I tried to solve this problem with :

linux 'source' command ... BAD!!!linux 'alias' command... BAD!!! But, I finally got a working solution by redefining a  'java' function before calling GOT IT! When calls 'java', it invokes my function. Like this :

java() {     /specificpath/jdk/bin/java "$@" } export -f java sh ./


Don't merge on Git

That's something I learnt. When use grab code from server, if you use 'git pull', it makes behind the scene two command 'git fetch' + 'git merge'.

Merge is bad because it doesn't respect commits order. So, you should prefer 'git rebase' which re-apply your commits to the code you just fetched. To do 'git fetch' + 'git rebase', you can make a 'git pull --rebase'. But, if you afraid to forget the rebase option, you can setup your git to do it by default with the following command :

git config --global pull.rebase true

Source :