Diego
Diego

Reputation: 63

Git read updates before pulling

Whenever I have a Git error on pulling, where "Updates were rejected because the tip of your current branch is behind" is there any way to know what are the updates that have been done on the origin repository after doing git fetch ?

Upvotes: 1

Views: 35

Answers (2)

mellowfish
mellowfish

Reputation: 684

After a git fetch of your origin repository, you would be able to run commands such as:

git log origin...HEAD 

This will show the git log of changes between your current HEAD and origin's HEAD. Be sure to pass in your favorite git log arguments here, I like --stat myself.

You can do something similar with the diff command:

git diff origin/master # or whatever your current branch is

This will show you the actual file changes on the remote.

Upvotes: 1

banderkat
banderkat

Reputation: 481

git rev-list HEAD..HEAD@{upstream}

after a git fetch returns a list of the new remote commits in reverse chronological order.

Upvotes: 1

Related Questions