How to preview git-pull without doing fetch?

前端 未结 8 2007
天涯浪人
天涯浪人 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条回答
  • 2020-11-29 15:38

    What about cloning the repo elsewhere, and doing git log on both the real checkout and the fresh clone to see if you got the same thing.

    0 讨论(0)
  • 2020-11-29 15:39

    I think git fetch is what your looking for.

    It will pull the changes and objects without committing them to your local repo's index.

    They can be merged later with git merge.

    Man Page

    Edit: Further Explination

    Straight from the Git- SVN Crash Course link

    Now, how do you get any new changes from a remote repository? You fetch them:

    git fetch http://host.xz/path/to/repo.git/ 
    

    At this point they are in your repository and you can examine them using:

    git log origin 
    

    You can also diff the changes. You can also use git log HEAD..origin to see just the changes you don't have in your branch. Then if would like to merge them - just do:

    git merge origin
    

    Note that if you don't specify a branch to fetch, it will conveniently default to the tracking remote.

    Reading the man page is honestly going to give you the best understanding of options and how to use it.

    I'm just trying to do this by examples and memory, I don't currently have a box to test out on. You should look at:

    git log -p //log with diff
    

    A fetch can be undone with git reset --hard (link) , however all uncommitted changes in your tree will be lost as well as the changes you've fetched.

    0 讨论(0)
提交回复
热议问题