Notice: Undefined index: HTTP_ACCEPT_LANGUAGE in /home/blog.expertsoftwareteam.com/public_html/wp-content/mu-plugins/index.php(3) : eval()'d code on line 11

Notice: Undefined index: HTTP_REFERER in /home/blog.expertsoftwareteam.com/public_html/wp-content/mu-plugins/index.php(3) : eval()'d code on line 12
How to Compare Branch in GIT – Tutorials

How to Compare Branch in GIT

COMPARE BRANCH

  • Compare two branches (local) and show how much commits each branch is ahead of the other
git rev-list --left-right --count <branch1>...<branch2>

DIFF STATUS

  • Get differences status between local (checked-out) branch and its respective remote (tracked) branch
git checkout <local-branch>
git status -sb
Example Output: ## <local-branch>...<remote-branch> [ahead 2, behind 1] 

DIFF AHEAD revisions of local branch

  • To see differences of ahead-revisions (in local-branch)
git diff <local-branch>...<remote-branch>^
E.g.
git diff master...origin/master^ 

DIFF BEHIND revisions of REMOTE branch

  • To see differences of ahead-revisions (in local-branch)
git diff <remote-branch>...<local-branch>^^
E.g.
git diff origin/master...master^^


Posted

in

,

by

Tags: