How to compare a local git branch with its remote branch?

Source: https://stackoverflow.com/questions/1800783/how-to-compare-a-local-git-branch-with-its-remote-branch

If [remote-path] and [local-path] are the same, you can do
$ git fetch origin master
$ git diff origin/master -- [local-path]
git diff origin/master src/app/pages/check-in/check-in-list.component.ts



How do I exit the results of 'git diff' in Git Bash on windows?

I think pressing Q should work.

Note 1: The second command above will compare against the locally stored remote tracking branch. The fetch command is required to update the remote tracking branch to be in sync with the contents of the remote server. Alternatively, you can just do
$ git diff master:<path-or-file-name>
Note 2: master can be replaced in the above examples with any branch name

git diff <local branch> <remote>/<remote branch>
For example git diff master origin/master, or git diff featureA origin/next
Of course to have said remote-tracking branch you need to git fetch first; and you need it to have up to date information about branches in remote repository.

Không có nhận xét nào:

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...