0

For reference:

After push, git says everything up to date but changes are not in the repo

Remote repo says it is up-to-date, but lacks hundreds of local commits

git repo says it's up-to-date after pull but files are not updated

My case is a bit different. I'm not being told that everything is up to date. Each time I push I'm given the $OLD_HASH..$NEW_HASH branch -> branch message as expected, and when I look at the logs for both the branch I'm on as well as remote/branch, it shows the two are up-to-date.

However, when I try to pull on my laptop, it says "Already up to date" so I push again getting the same message as before, saying that the commit is being pushed. That is to say, it pushed the same commit again.

Just to be sure I clone the repo, and sure enough the pushed commit (just one) is missing.

I check the URLs, just to make sure nothing weird happened without my knowledge. I then hop on the internet and try to find out what other people have done.

The common solutions are in response to pushing and being told that "Everything up to date". The solution to that problem is to add everything, commit, and then push. However this is not the case for me, since I have a commit, it is being pushed (repeatedly) and locally it is shown as having been pushed.

Another thing suggested was git push remote branch:branch which I did try without any difference in effectiveness.

The next thing I tried was to fetch. After fetching the local repo's log shows that the HEAD of the remote branch is indeed one commit behind, however when I then push (without real effect) it is shown to have moved, when in reality it has not as verified by trying to pull to the clone.

The remote seems to be fine. I pushed to it earlier from my laptop and pulled to my desktop.

Finally I tried

cp file temp
fit fetch --all
git reset --hard remote/branch
mv temp file
git add file
git commit -m"message"
git push

where file is the file I had been working on. However this didn't work any better than what had been tried before (in other words, not at all). Also, please take note that I do not think that git reset --hard is affecting the remote. Rather, I know it is affecting the local repo only.

Just not I tried pushing to a different repo on the same server, and its working fine. Its just the one repo, which was working fine a few hours ago.

Moreover, looking at the remote's own client on my tablet (as opposed to CLI git I've been using) it shows that I pushed to the remote minutes ago, even though the commit isn't showing.

I was requested to share the output of git status

$ git status
On branch devel
Your branch is up to date with 'origin/devel'.
nothing to commit, working tree clean

Another thing I just tried was to git checkout -b test then git push -u remote test but the branch didn't actually get pushed despite git saying that it was.

I just tried making a new remote repo. I removed the remote from the local repo, added the new remote, then pushed with git push -u. Same result. That one commit isn't making it into the remote for some reason.

As for a complete (albeit obfuscated) push output:

$ git push
Initializing Keybase... done.
Syncing with Keybase... done.
To keybase://private/my/repo
hashA..hashB branch -> branch

As I said, no errors, but that isn't to say this is normal. For another repo:

$ git push
Initializing Keybase... done.
Syncing with Keybase... done.
Counting and decrypting: 4 objects... done.
Preparing and encrypting: (100.00%) 4/4 objects... done.
Indexing hashes: (100.00%) 4/4 objects... done.
Indexing CRCs: (100.00%) 4/4 objects... done.
Indexing offsets: (100.00%) 4/4 objects... done.
Syncing encrypted data to Keybase: (100.00%) 200.65/200.65 KB... done.
To keybase://private/my/otherRepo
hashC..hashD otherBranch -> otherBranch

I took another look at the git logs, and it seems as if there is some strange divergence going on. The commit I keep trying to push exists in multiple branches (normal) with three different commit hashes (not normal). I'm going to look into this further. I'm not completely sure what is going on, so I can't give an accurate report, but this is new information.

In fact, now that I'm looking at the history, instead of just the tips, something really weird is going on. My local repos are messed up. I knew they weren't in an especially good state (I rebased down to the root to fix a missing filter problem which separated everything into discrete branches with no common hystory) but I don't think that is the cause of this.

Still, if I force push I'd expect the commit to be there no matter what.

Nero gris
  • 562
  • 7
  • 15
  • Can you share what your `git status` says after `git add file`? – nitishagar Oct 18 '18 at 15:37
  • I added the current output after a push. Do you mean after I reset to the remote's branch, but before I push? – Nero gris Oct 18 '18 at 15:42
  • 1
    The issue may be with the configuration in the local repository that's *not* seeing the updates (on the laptop). Just to be clear: there are at least three repositories involved here. In one repository, you run `git commit` and `git push`. A second repository resides on some server; this server receives the `push`. A *third* repository resides on your laptop, and running `git pull` on your laptop does not obtain new items from the server and merge them in, and it's likely that the problem is the configuration of Git on your laptop, in this third repo. – torek Oct 18 '18 at 16:03
  • 1
    Here is the thing though, I don't think the server is receiving the commit. And its not just the laptop repo that isn't getting the commit, the recently cloned repo on my desktop isn't getting it either, and when I fetch to the original desktop repo, it shows that the remote branch is one commit behind. Also, when I push again, I'm NOT told that the remote is up-to-date, but rather that it successfully executed the same push. Furthermore, I created a new remote repo and it has the same problem. – Nero gris Oct 18 '18 at 16:07
  • `git reset --hard remote/branch` probably doesn't do what you think it does. That command will *not* affect the remote: it only affects your local copy of the remote's branch. – Matt Messersmith Oct 18 '18 at 16:12
  • I don't think it does affect the remote. I think I'm forcing the head of the local branch to the tip of the remote branch as stored locally, which, after a fetch, should match up with the remote. – Nero gris Oct 18 '18 at 16:20
  • What does the output of `push` say? No error message after the `$OLD_HASH..$NEW_HASH branch -> branch` message? – lucidbrot Oct 18 '18 at 18:19
  • That is the last line. There is nothing out of the ordinary until you try to push the commit again or pull it. The former repeats the action as if it never happened and the latter also is executed as if nothing was pushed. – Nero gris Oct 18 '18 at 18:39
  • Please post the literal output of your `git push` invocation (and all of) including the command itself, not just a transliteration (I doubt that your output included `branch -> branch` literally). You may obfuscate names in the URLs, but please keep the structure of the URL and the branch names unchanged. – j6t Oct 19 '18 at 09:11
  • @j6t I've posted the requested info. – Nero gris Oct 20 '18 at 01:29
  • The messages that your server produces do not occur in plain Git. It must be some other server software. I think you should ask whoever is operating the servers for help. – j6t Oct 20 '18 at 19:56
  • Actually, that extra stuff is normal. Its absences is not. In any case, I've kind of found the problem, though I have no idea how it happened. I'm going to update the question now. – Nero gris Oct 21 '18 at 22:37

0 Answers0