Reputation: 670
Is where are a better way to understand is where any new commit will be fetched with git fetch when:
git fetch origin --dry-run -v 2>&1| grep 'master'| grep 'up to date'
And then, if output looks like:
= [up to date] master -> origin/master
I will not need to do actual fetch, and if not - i do a fetch.
I'm using this method right now, but i wonder is where are a better solution?
Also i want to check similar thing for hg - is where are a way to do so?
Upvotes: 0
Views: 1336
Reputation: 38116
You can use git fetch --dry-run
to check if remote has new changes to fetch. It will
show what would be done without making any changes
.
Also you can use hg incoming
to check if there has changes to fetch.
Mercurial provides the
hg incoming
command to tell us what changes thehg pull
command would pull into the repository, without actually pulling the changes in.
Upvotes: 3