4 ms·
When calling fetch and then merge (or using rebase), you have more control over how the other changes impact your commits. Just pulling will result in a merge c
by nahname 15y ago
When calling fetch and then merge (or using rebase), you have more control over how the other changes impact your commits. Just pulling will result in a merge commit that contains all of the changes between the point you last pulled. This becomes confusing because it will look like you are adding files or making changes, when you are actually not.
The reason this happens is because git uses directed graphs and there is no link between the point at which you diverged from master and the other changes came in. The merge commit creates this. Unfortunately, it looks like you just committed everything that changed on both branches and the history can be difficult to track and/or confusing.
Fetch then merge will make the history more clear, but you still create a merge commit that will include all of the file changes (correct me if I am wrong here). git pull --rebase will take your changes out of the equation, pull in the new history and then replay them against the updated master branch. This is nice because your commit will only include (at this point) any merge conflicts resulting from your changes.
For a better explanation, with diagrams, see http://progit.org/book/ch3-6.html http://progit.org/book/ch3-6.html
- meatmanek 15y ago> Unfortunately, it looks like you just committed everything that changed on both branches and the history can be difficult to track and/or confusing. I don't think this is really true. You'll just introduce a single merge commit on top of both your commits and the other person's. Yes, if you diff that merge against your own work, you'll see all the work that other people committed, but I think it's fairly well understood that a merge commit is just that - you merging your changes with other changes. It can be a bit tricky to read the log when merge commits are involved, but try the --graph option or a graphical log tool.