Quantcast
Channel: Hacker News 50
Viewing all articles
Browse latest Browse all 9433

Krzysztof Hasiński : Please, oh please, use git pull --rebase

$
0
0

Comments:"Krzysztof Hasiński : Please, oh please, use git pull --rebase"

URL:https://coderwall.com/p/7aymfa


When working on a project you usually synchronize your code by pulling it several times a day. What you might not know is that by typing

git pull

you actually issuing git fetch + git merge commands, which will result with an extra commit and ugly merge bubbles in your commit log (check out gitk to see them).

It's much better to use

git pull --rebase

to keep the repository clean, your commits always on top of the tree until you push them to a remote server. The command will apply all your yet-to-be-pushed commits on top of the remote tree commits allowing your commits to be straight in a row and without branches (easier git bisects, yay!).

Few notes though. If you want to merge a feature branch it might be wiser to actually merge your commits thus having a single point of integration of two distinct branches.

Also the conflict resolving will be now per commit basis, not everything-at-once, so you will have to use

git rebase --continue

to get to the next batch of conflicts (if you have any).


Viewing all articles
Browse latest Browse all 9433

Trending Articles