How to see code changes after git pull?

后端 未结 5 1261
孤城傲影
孤城傲影 2020-12-07 09:19

I would like to inspect any code changes after doing a git pull. Currently it\'s just showing me which files changes. How can I see what code changed?

5条回答
  •  不知归路
    2020-12-07 09:55

    Because git pull is just a shortcut for git fetch and git merge, you can run git fetch to fetch the branches from the origin and then show the differences before merging. Like this:

    git fetch                      # Load changes from remote server
    git diff master origin/master  # Show differences
    git merge origin/master        # Merge remote changes with local changes
    

    If you run on a different branch than master, you should of course change the branch names in the commands above.

提交回复
热议问题