0

I have git master branch, which had some updates which i didn't updated on local machine and created a new commit and tried to push it to master branch, however it rejected my commits and throws error saying there are updates on the remote branch which need to be merged on local machine first before sending any commits to remote branch

Now i don't know what are the updates currently on remote branch which i have not yet pulled it in my local copy, as it's the master branch (production copy) i am bit concerned about what updates it will bring into my local copy which is currently working.

Is there any way i can see what updates it will bring if i make a fetch call in GIT.

Any help will be greatly appreciated

Abbas
  • 4,948
  • 31
  • 95
  • 161
  • Possible duplicate of [How to preview git-pull without doing fetch?](http://stackoverflow.com/questions/180272/how-to-preview-git-pull-without-doing-fetch) – Andrew C Oct 26 '15 at 21:10

1 Answers1

1

git fetch will not do anything to your working copy. You need to either merge or rebase to get the new changes into your working copy.

So, you must git fetch first to be able to check anything that is happening on the remote.

You should be able to check the state of origin/master, the remote branch, using any of several different commands. Among others:

git log origin/master
git diff master origin/master
Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
  • Is there a way i can print all logs or diffs in the notepad file, because when i passed this command, it updated the command window only, and i need to press "Enter" everytime to see more information. – Abbas Oct 26 '15 at 19:40
  • You can pipe the result to a file `git diff master origin/master > diff.txt` – Andreas Wederbrand Oct 26 '15 at 20:16
  • I ran exact same above command, it ran successfully, but could not find the diff.txt file anywhere inside git folder, can you please tell me where can i find it. – Abbas Oct 26 '15 at 20:27
  • It'll end up in the same directory as you ran the command from. – Andreas Wederbrand Oct 27 '15 at 09:43