0

I have a git repo which may have gotten out of sync in a bad way with a remote repo. I need to see what the differences are (both incoming and outgoing), without putting either repository at risk for bad changes. (so from what I understand, git fetch would do that, and I can't risk that.)

Is there a way to do this?

Jason S
  • 184,598
  • 164
  • 608
  • 970
  • you would still normally use `git fetch` in this instance. That's standard procedure to see what the remote has before you merge it into your changes. – Andrew C Nov 16 '15 at 23:20

1 Answers1

2

In the simplest terms, git pull does a git fetch followed by a git merge. You can do a git fetch at any time to update your remote-tracking branches under refs/remotes//. This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy.

What is the difference between 'git pull' and 'git fetch'?

You can use the git fetch without a risk.

Community
  • 1
  • 1
m.aibin
  • 3,528
  • 4
  • 28
  • 47
  • OK, so it merely updates a local copy of the remote branches? – Jason S Nov 17 '15 at 00:07
  • It just show the changes. Git pull is simply fetching and then immediately trying to merge. – m.aibin Nov 17 '15 at 00:12
  • @jason yes, fetch update just the remotes which are the states of the branches in the other distant repositories. After the update, you could compare, look at changes and decide what to do, and that, without risk until you decide to merge, rebase or reset your local branches... – Philippe Nov 17 '15 at 00:25