Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

How can I see the diff between a local branch and a remote branch?

1 Answer

0 votes
by (50.2k points)

To compare the remote branch you just need to update the remote branch using

git fetch

Then you can differentiate using

git diff <masterbranch_path> <remotebranch_path>

You can use git branch -a to list all branches then choose the branch name from the list from the remote branch name.

Example: 

git diff master origin/master (where "master" is a local master branch and "origin/master" is a remote namely origin and master branch.)

Reference: https://git-scm.com/docs/git-diff

31k questions

32.4k answers

501 comments

693 users

Browse Categories

...