Git: How to check if a local repo is up to date?
git remote show origin
Result:
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (local out of date) <-------
First use git remote update
, to bring your remote refs up to date. Then you can do one of several things, such as:
git status -uno
will tell you whether the branch you are tracking is ahead, behind or has diverged. If it says nothing, the local and remote are the same. Sample result:
On branch DEV
Your branch is behind 'origin/DEV' by 7 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
git show-branch *master
will show you the commits in all of the branches whose names end in 'master' (eg master and origin/master).
If you use -v
with git remote update (git remote -v update
) you can see which branches got updated, so you don't really need any further commands.
Try git fetch --dry-run
The manual (git help fetch
) says:
--dry-run
Show what would be done, without making any changes.