0

When working in a repo, Git will display a message when calling git status that your ahead of origin/branchName by x amount of commits. But if the remote repository was updated for example, by someone else on another computer and they push, so I am actually behind the remote repository. Will calling git status notify me of this?

bmcentee148
  • 594
  • 1
  • 7
  • 18
  • 1
    `git status` only tells you where you are relative to `origin` based on the last time it checked origin (via fetch or push). So no, `git status` alone will not notify you of this. – Andrew C Nov 14 '14 at 00:23

2 Answers2

1

git fetch followed by git status will tell you if are behind on your current branch if it tracks a remote branch. Running git fetch won't touch any local refs, and you can use --dry-run if you are paranoid about what it will do.

This is possibly a duplicate of git ahead/behind info between master and branch?

Community
  • 1
  • 1
engineerC
  • 2,808
  • 17
  • 31
0

You need to do git fetch that means pulling only information of the remote repository.

Dongho Yoo
  • 1,506
  • 16
  • 16