Search code examples
gitgit-fetch

How to see what will be merged after git fetch


My question is after doing a git fetch how can I see what is what git actually fetched from origin? I have my guesses by using diff but I don't know exactly how I can do it.


Solution

  • Due to the fact that after a git fetch the fetched references are in origin/master (just an example, if you have more branches then they are updated as well as origin/<name> and you can apply the following commands as well) you have several options here:

    1. Display file names only that have been changed

    git diff --name-only origin/master
    

    2. Display file status only

    git diff --name-status origin/master
    

    3. Really show what changed

     git diff origin/master
    

    Or you use git show for this task: git show --oneline --name-only master..origin/master

    And for completeness you can use the following command to count commits that where fetched.

    git rev-list --count HEAD..origin/master