Tuesday, March 22, 2016

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 : https://coderwall.com/p/tnoiug/rebase-by-default-when-doing-git-pull

1 comment:

simashree said...

Thanks for the great information in your blog Selenium Training in Chennai