Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does "git status" actually check whether upstream repo matches my repo?

Tags:

git

github

It doesn't look like

git status

actually checks whether my commits on github for example are fully in sync with my local state. Which isn't surprising because of the performance issues. How do I force a true check?

like image 558
pitosalas Avatar asked Nov 29 '22 23:11

pitosalas


2 Answers

You need to do a fetch first. This will update your local repo to match the remote.

git fetch origin
git status

Fetch will not change your working directory, like git pull does.

like image 198
jessenden Avatar answered Dec 04 '22 04:12

jessenden


Short answer: No it does not.

It compares your current working directory to your local HEAD commit.

From the documentation:

Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git (and are not ignored by gitignore[5]).

https://git-scm.com/docs/git-status

like image 41
Fabian Bettag Avatar answered Dec 04 '22 04:12

Fabian Bettag