Koray Tugay
Koray Tugay

Reputation: 23780

How to learn if my branch is behind the remote repository in Git using command line?

What is the command that I should use in Windows to learn if I am behind the repository?

Upvotes: 0

Views: 72

Answers (2)

alestanis
alestanis

Reputation: 21863

Simply type

git status

It will tell you how many commits ahead you are:

ahead by one commit

For "behind", you have to do

git fetch

and then a git status:

enter image description here

Upvotes: 3

Michael Wild
Michael Wild

Reputation: 26341

First you have to fetch new references from the repository:

git fetch <remote> <branch>

Then using

git status

will tell you how many commits you are behind.

Upvotes: 1

Related Questions