We have a Git repository hosted on a shared network drive that multiple co-workers access. I'll call this the "central repository". Employees clone this repository to their local machines, make changes, and then push changes back up.
We've noticed that if someone pushes a change to the central repository, other employees' local Git repositories don't indicate that they are out of sync. git status
says
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
But it's clearly not up-to-date. There are changes on the remote, but Git isn't sensing them. You can do a git pull
and it immediately downloads the changes to your local repository even though it claimed it was already up-to-date.
Why is this happening? Is it because the central repository is hosted on a shared network drive? And maybe Git is for whatever reason not able to tell if it's out of sync? Using a GUI like Tower doesn't make a difference either. Even hitting "Refresh" in the GUI does not make any indication that it's out of sync. Also, the local master branch is tracking origin/master
.
Is there anything that can be done to fix this problem?
This status message is OK. We are up-to-date, there is nothing to commit, but there is still an untracked file. Since this file should not belong in git, this status shows a good git repo with all updates available to the instructor and the partner.
The message “Already up-to-date” means that all the changes from the branch you're trying to merge have already been merged to the branch you're currently on. More specifically it means that the branch you're trying to merge is a parent of your current branch.
To check if you're up-to-date with GitHub run git fetch origin before git status and you'll know you're up-to-date.
If your current local branch is linked to a remote branch, then git status will tell you if your local branch is behind or ahead by any commits.
You have to call git fetch
to get updates from the remote repository to your local repository, but without changing your current branch position. After that, git status
will show proper results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With