Git Says Diverged: List the Commits Each Side Has Before You Pull

First confirm which branch is configured as your upstream. Then inspect git log --left-right --oneline HEAD...@{upstream} before integrating anything. The local and upstream commits appear on opposite sides of the comparison.

Confirm the tracking branch and its freshness

Use git branch -vv to find the upstream for the current branch, and verify that it is the target you expect. The result compares local references. If the remote may have changed and you are authorized to read it, run a normal fetch from that remote first. The inspection itself can be done without changing the working tree.

Read the two commit sets

git status --short --branch
git log --left-right --oneline 'HEAD...@{upstream}'
git rev-list --left-right --count 'HEAD...@{upstream}'

Quoting the range also makes it convenient in common shells. The left side is HEAD, and the right side is the upstream. In a synthetic result of 2 and 3, two commits are reachable only from local HEAD and three only from the upstream. A rebased copy of a similar change may have a different commit identity.

Choose a team-approved integration method

Check whether local-only commits have already been shared and whether the project expects merges or rebases. Check the working tree before any integration. If the upstream is missing or wrong, confirm the intended remote and branch before changing it. Once the changes have been integrated, run the comparison again and verify that the expected commit history is reachable.

Sources

댓글

이 블로그의 인기 게시물

소니 A6000 Wi-Fi 전송 (컴퓨터로 보내기)

SVN 서버 설치 및 웹 접속 설정-Ubuntu 14.04

VirtualBox(VM) 화면 크기 조절