How to preview git-pull without doing fetch?

前端 未结 8 2018
天涯浪人
天涯浪人 2020-11-29 14:41

Is it even possible?

Basically, there\'s a remote repository from which I pull using just:

git pull

Now, I\'d like to preview what

8条回答
  •  Happy的楠姐
    2020-11-29 15:14

    I use these two commands and I can see the files to change.

    1. First executing git fetch, it gives output like this (part of output):

      ...
      72f8433..c8af041  develop -> origin/develop
      ...

    This operation gives us two commit IDs, first is the old one, and second will be the new.

    1. Then compare these two commits using git diff

      git diff 72f8433..c8af041 | grep "diff --git"

    This command will list the files that will be updated:

    diff --git a/app/controller/xxxx.php b/app/controller/xxxx.php
    diff --git a/app/view/yyyy.php b/app/view/yyyy.php
    

    For example app/controller/xxxx.php and app/view/yyyy.php will be updated.

    Comparing two commits using git diff prints all updated files with changed lines, but with grep it searches and gets only the lines contains diff --git from output.

提交回复
热议问题