I have read that git pull
= git fetch
+ git merge
, and that the latter is usually preferred because it allows one to review changes before merging them.
Our small development team is sharing a git repo on a server. My colleague just pushed and I fetched, so that his commits are now in my local repository. I can see them with:
git log ..origin/mybranch
and inspect them with:
git diff <hash>
Now let's imagine that I want to merge the changes into my working copy, but I don't like some commits or parts of one commit.
My question is:
- how do I go about "modifying" a commit before merging it into my working copy?
- in case I can do the above, will that affect the remote repository? (I have read that one should not rebase after a push, for example)
- in case I cannot do the above, how do I fix the changes after merging them? (eg. manually, ...)
In short: can someone give an overview of actions that are typically performed between a "fetch" and a "merge" to review and edit changes?