Wednesday, February 19, 2014

git: merging versus rebasing

I used to do:
(edit my files)
git pull
git add myfiles
git commit -m "blablabla"
git push


and life was fine, until I was suggested to use rather:
(edit my files)
git fetch
git add myfiles
git commit -m "blablabla"
git rebase
git push

the changes are:
  • fetch instead of pull 
  • add the "rebase" step 

in alternative you can do:
git pull --rebase 
instead of
git fetch + git rebase

Using "rebase" will generate a simpler history in the repository.

All this is very well explained here.



No comments: