{"thread":{"id":"30641","subject":"\"git push\" silently fails, says 'Everything up-to-date\" when it's not.","startedAt":"2012-05-28T11:53:31Z","lastAt":"2012-05-29T18:53:31Z","messageCount":3,"participants":["David Woodhouse","Matthieu Moy","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"192382","messageId":"1338206011.11518.115.camel@shinybook.infradead.org","threadId":"30641","inReplyTo":null,"subject":"\"git push\" silently fails, says 'Everything up-to-date\" when it's not.","fromName":"David Woodhouse","fromEmail":"dwmw2@infradead.org","sentAt":"2012-05-28T11:53:31Z","receivedAt":"2012-05-28T11:53:31Z","isPatch":false,"sender":{"key":"dwmw2@infradead.org","avatar":"https://gravatar.com/avatar/7afd4f07e0cf7d7e046ae2d23678296b37777c96488e6f3451e78a5514154ebd?d=mp&s=160"},"body":"I *thought* I'd pushed everything from my tree out to the server a\ncouple of weeks ago, and 'git push' appears to confirm that:\n\n[dwmw2@shinybook mtd-2.6]$ git push\nEverything up-to-date\n\nBut it lies. Only when I try to *pull* does it give me a hint:\n\n[dwmw2@shinybook mtd-2.6]$ git pull\nYou are not currently on a branch, so I cannot use any\n'branch.<branchname>.merge' in your configuration file.\nPlease specify which branch you want to merge with on the command\nline and try again (e.g. 'git pull <repository> <refspec>').\nSee git-pull(1) for details.\n\nSo I've been happily thinking that my commits were actually in\nlinux-next for the last couple of weeks when they weren't. OK, I could\nhave checked in gitweb — silly me for trusting the tools.\n\nWhy would it do this evil thing and start lying to me? When it told me\n'Everything up-to-date', precisely *what* was it telling me was up to\ndate? Did it ever push *anything*, *anywhere*, or was it just a complete\nfabrication?\n\nI don't quite know how I ended up \"not currently on a branch\" either. I\nalmost never use branches locally and my local tree has *never* been\nchanged to another branch; I always use separate trees instead of\nbranches. I may have committed a few things, then reverted them with\n'git reset HEAD^^^^' and re-committed them with some changes. But that\nshouldn't cause this, surely?\n\nWhen I have a clone a remote tree, and I run 'git push', surely my HEAD\nshould be pushed to the HEAD of the remote tree? There's little excuse\nfor *telling* me it's up-to-date, when it's not!\n\nI understand that some people like the branch facility even though I\nfind it mostly pointless, but I'd prefer that it didn't undermine basic\nusability of git :(\n\n-- \ndwmw2\n"},{"id":"192383","messageId":"vpqipfgec9k.fsf@bauges.imag.fr","threadId":"30641","inReplyTo":"1338206011.11518.115.camel@shinybook.infradead.org","subject":"Re: \"git push\" silently fails, says 'Everything up-to-date\" when it's not.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-05-28T12:11:19Z","receivedAt":"2012-05-28T12:11:19Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"David Woodhouse <dwmw2@infradead.org> writes:\n\n> [dwmw2@shinybook mtd-2.6]$ git push\n> Everything up-to-date\n>\n> But it lies. Only when I try to *pull* does it give me a hint:\n>\n> [dwmw2@shinybook mtd-2.6]$ git pull\n> You are not currently on a branch, so I cannot use any\n\nWhat does\n\n  git config push.default \n\nsay?\n\nYou probably have push.default=matching, which is the default. In this\nmode, Git will push all your local branches to remote branches having\nthe same name (regardless of which branch you currently have\nchecked-out). The commits you just did were not on any branch, so\nthey're not pushed.\n\n> Why would it do this evil thing and start lying to me? When it told me\n> 'Everything up-to-date', precisely *what* was it telling me was up to\n> date? Did it ever push *anything*, *anywhere*, or was it just a complete\n> fabrication?\n\nIt probably pushed your branches, but not commits done in detached HEAD.\n\n> I don't quite know how I ended up \"not currently on a branch\" either.\n\nEither you did \"git checkout <some-commit-identifier>\" (in which case\nyou had a big fat warning), or you used one command that runs in\ndetached HEAD like \"git rebase\" or \"git bisect\" without concluding the\noperation (\"git bisect reset\", \"git rebase --continue\" or so).\n\nWith a recent enough version of Git, each commit you did in detached\nhead had this little reminder:\n\n$ git commit -m foo\n[detached HEAD acb1d5b] foo\n ^^^^^^^^^^^^^\n\nAs for the future, there's a patch serie in progress that will make \"git\nstatus\" warn a bit more loudly in these cases, and give you a clue about\nwhat to do next.\n\nIn Git 2.0, the push.default value will change to \"simple\", which errors\nout like this in your case:\n\n$ git push\nfatal: You are not currently on a branch.\nTo push the history leading to the current (detached HEAD)\nstate now, use\n\n    git push origin HEAD:<name-of-remote-branch>\n\nIf you can't wait to have this \"simple\" mode, you may want to set\npush.default=upstream (or current), which will push the current branch\nto its upstream (or to the one with the same name remotely).\n\nI don't know what can be done to improve the case of detached HEAD with\npush.default=matching. Perhaps Git should warn when HEAD is not pushed\n(detached HEAD, or HEAD points to a branch that doesn't exist remotely)?\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"192427","messageId":"7vipfe4y50.fsf@alter.siamese.dyndns.org","threadId":"30641","inReplyTo":"vpqipfgec9k.fsf@bauges.imag.fr","subject":"Re: \"git push\" silently fails, says 'Everything up-to-date\" when it's not.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-29T18:53:31Z","receivedAt":"2012-05-29T18:53:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> I don't know what can be done to improve the case of detached HEAD with\n> push.default=matching. Perhaps Git should warn when HEAD is not pushed\n> (detached HEAD, or HEAD points to a branch that doesn't exist remotely)?\n\nPlease don't.  For those whose workflow clearly separates local\nhistory building (checking different branches, making commits, etc.)\nand publishing the result (git push), \"git push\" is *not* a way to\nsay \"I am done with the work I have been doing on *this* branch\",\nbut is a way to say \"I am done for the day, and all the branches I\npush out are in good order\". It does not matter what branch the user\nhappens to be on when \"git push\" is run for them (including me).\n"}]}