简体   繁体   中英

How can I see what changes have been made in a git repository without pulling it into my working tree

For example, I could just git pull and then git checkout HEAD-1. But is there a way of seeing the differences before deciding whether to git pull or not?

Do a git fetch first to update your remote tracking branch. Then use git log ..origin to see what has changed in the "origin" branch. Then you can do a git pull if you are satisfied with the changes.

If you really want to avoid any trace of the remote changes getting into your repo, you can do a local git clone , which will use hardlinks, so will take almost no extra space, and then apply Greg Hewgill's answer to that. If you are satisfied, you can go back to the original repository and pull from the local clone to avoid going over the network, although you should follow up with a git fetch in the original repository to make sure your remote tracking branches are up to date.

Normally, that isn't necessary, of course.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM