{"thread":{"id":"46653","subject":"How to force a push to succeed?","startedAt":"2017-08-22T21:55:32Z","lastAt":"2017-08-23T17:06:59Z","messageCount":8,"participants":["Jeffrey Walton","Stefan Beller","Kevin Daudt","Jonathan Nieder","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"326979","messageId":"CAH8yC8=A0-geqduTNNJw0yb1BREqsB75_bKSp+06Rb5fY6oiuQ@mail.gmail.com","threadId":"46653","inReplyTo":null,"subject":"How to force a push to succeed?","fromName":"Jeffrey Walton","fromEmail":"noloader@gmail.com","sentAt":"2017-08-22T21:55:25Z","receivedAt":"2017-08-22T21:55:32Z","isPatch":false,"sender":{"key":"noloader@gmail.com","avatar":null},"body":"I tested some changes that lead to a dead end. The changes need to be\nremoved. The changes were added in 7 commits.\n\nI went back in time to the point before the changes:\n\n    $ git reset --hard HEAD~7\n    HEAD is now at 559fc3b Fix benchmark selection code (GH #464)\n\nWhen I attempted to push:\n\n    $ git push\n    Username for 'https://github.com': noloader\n    To https://github.com/noloader/cryptopp.git\n     ! [rejected]        master -> master (non-fast-forward)\n\nI tried to commit, but Git claims there's nothing to add:\n\n    $ git commit\n    On branch master\n    Your branch is behind 'origin/master' by 7 commits, and can be\nfast-forwarded.\n\nCommit seems to be the wrong command as Git appears to be trying to do\nsomething I don't want.\n\nHow do I force the push to succeed?\n\nThanks in advance.\n"},{"id":"326980","messageId":"CAGZ79kYyO4zvmTvMpxpFyBEs4f=xoy_-UeSbmi9W-OCFz0kCwQ@mail.gmail.com","threadId":"46653","inReplyTo":"CAH8yC8=A0-geqduTNNJw0yb1BREqsB75_bKSp+06Rb5fY6oiuQ@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-08-22T21:57:31Z","receivedAt":"2017-08-22T21:57:37Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Tue, Aug 22, 2017 at 2:55 PM, Jeffrey Walton <noloader@gmail.com> wrote:\n> I tested some changes that lead to a dead end. The changes need to be\n> removed. The changes were added in 7 commits.\n>\n> I went back in time to the point before the changes:\n>\n>     $ git reset --hard HEAD~7\n>     HEAD is now at 559fc3b Fix benchmark selection code (GH #464)\n>\n> When I attempted to push:\n>\n>     $ git push\n>     Username for 'https://github.com': noloader\n>     To https://github.com/noloader/cryptopp.git\n>      ! [rejected]        master -> master (non-fast-forward)\n>\n> I tried to commit, but Git claims there's nothing to add:\n>\n>     $ git commit\n>     On branch master\n>     Your branch is behind 'origin/master' by 7 commits, and can be\n> fast-forwarded.\n>\n> Commit seems to be the wrong command as Git appears to be trying to do\n> something I don't want.\n>\n> How do I force the push to succeed?\n>\n> Thanks in advance.\n\nCheckout the --force[-with-lease] argument.\n\nhttps://git-scm.com/docs/git-push\n"},{"id":"326981","messageId":"CAH8yC8nu7zDmkQMZ99SpePXL1WpvvcOdQDAtwdo4WXiPiR3tOQ@mail.gmail.com","threadId":"46653","inReplyTo":"CAGZ79kYyO4zvmTvMpxpFyBEs4f=xoy_-UeSbmi9W-OCFz0kCwQ@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Jeffrey Walton","fromEmail":"noloader@gmail.com","sentAt":"2017-08-22T22:03:37Z","receivedAt":"2017-08-22T22:03:42Z","isPatch":false,"sender":{"key":"noloader@gmail.com","avatar":null},"body":"On Tue, Aug 22, 2017 at 5:57 PM, Stefan Beller <sbeller@google.com> wrote:\n> On Tue, Aug 22, 2017 at 2:55 PM, Jeffrey Walton <noloader@gmail.com> wrote:\n>> I tested some changes that lead to a dead end. The changes need to be\n>> removed. The changes were added in 7 commits.\n>>\n>> I went back in time to the point before the changes:\n>>\n>>     $ git reset --hard HEAD~7\n>>     HEAD is now at 559fc3b Fix benchmark selection code (GH #464)\n>>\n>> When I attempted to push:\n>>\n>>     $ git push\n>>     Username for 'https://github.com': noloader\n>>     To https://github.com/noloader/cryptopp.git\n>>      ! [rejected]        master -> master (non-fast-forward)\n>>\n>> I tried to commit, but Git claims there's nothing to add:\n>>\n>>     $ git commit\n>>     On branch master\n>>     Your branch is behind 'origin/master' by 7 commits, and can be\n>> fast-forwarded.\n>>\n>> Commit seems to be the wrong command as Git appears to be trying to do\n>> something I don't want.\n>>\n>> How do I force the push to succeed?\n>>\n>> Thanks in advance.\n>\n> Checkout the --force[-with-lease] argument.\n\nPerfect, thanks.\n\nJeff\n"},{"id":"326982","messageId":"CAH8yC8nHnbWTG4hxD+mEHKPS6eWcBb7yMsgN886=aTWaBRhE5A@mail.gmail.com","threadId":"46653","inReplyTo":"CAH8yC8nu7zDmkQMZ99SpePXL1WpvvcOdQDAtwdo4WXiPiR3tOQ@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Jeffrey Walton","fromEmail":"noloader@gmail.com","sentAt":"2017-08-22T22:10:56Z","receivedAt":"2017-08-22T22:11:01Z","isPatch":false,"sender":{"key":"noloader@gmail.com","avatar":null},"body":"On Tue, Aug 22, 2017 at 6:03 PM, Jeffrey Walton <noloader@gmail.com> wrote:\n> On Tue, Aug 22, 2017 at 5:57 PM, Stefan Beller <sbeller@google.com> wrote:\n>> On Tue, Aug 22, 2017 at 2:55 PM, Jeffrey Walton <noloader@gmail.com> wrote:\n>>> I tested some changes that lead to a dead end. The changes need to be\n>>> removed. The changes were added in 7 commits.\n>>>\n>>> I went back in time to the point before the changes:\n>>>\n>>>     $ git reset --hard HEAD~7\n>>>     HEAD is now at 559fc3b Fix benchmark selection code (GH #464)\n>>>\n>>> When I attempted to push:\n>>>\n>>>     $ git push\n>>>     Username for 'https://github.com': noloader\n>>>     To https://github.com/noloader/cryptopp.git\n>>>      ! [rejected]        master -> master (non-fast-forward)\n>>>\n>>> I tried to commit, but Git claims there's nothing to add:\n>>>\n>>>     $ git commit\n>>>     On branch master\n>>>     Your branch is behind 'origin/master' by 7 commits, and can be\n>>> fast-forwarded.\n>>>\n>>> Commit seems to be the wrong command as Git appears to be trying to do\n>>> something I don't want.\n>>>\n>>> How do I force the push to succeed?\n>>>\n>>> Thanks in advance.\n>>\n>> Checkout the --force[-with-lease] argument.\n\nThanks again Stefan,\n\nFrom another testing machine, it looks like the changes have not been\nbacked out. The previous operation un-did the ADX gear because it was\nan evolutionary dead-end.\n\nvia$ git pull\nFrom https://github.com/noloader/cryptopp\n + 66654dd...559fc3b master     -> origin/master  (forced update)\nAlready up-to-date.\nvia:$ cat integer.cpp | grep ADX\n#if defined(CRYPTOPP_ADX_AVAILABLE)\n# define CRYPTOPP_INTEGER_ADX 1\n#if CRYPTOPP_INTEGER_SSE2 || CRYPTOPP_INTEGER_ADX\n#if CRYPTOPP_INTEGER_ADX\nextern int CRYPTOPP_FASTCALL ADX_Add(size_t N, word *C, const word *A,\nconst word *B);\n#if CRYPTOPP_INTEGER_ADX\n        if (HasADX())\n                s_pAdd = &ADX_Add;\n#if CRYPTOPP_INTEGER_SSE2 || CRYPTOPP_INTEGER_ADX\n\nAbove, there should be no references to ADX. Looking at the GitHub the\nchanges have been applied.\n\nAny ideas?\n\nJeff\n"},{"id":"326985","messageId":"CAH8yC8=HuAZ0tJbRGnp83-Th5OkQ0-cdSOBrMU23y6NyB0Ax3g@mail.gmail.com","threadId":"46653","inReplyTo":"CAH8yC8nHnbWTG4hxD+mEHKPS6eWcBb7yMsgN886=aTWaBRhE5A@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Jeffrey Walton","fromEmail":"noloader@gmail.com","sentAt":"2017-08-22T22:26:17Z","receivedAt":"2017-08-22T22:26:22Z","isPatch":false,"sender":{"key":"noloader@gmail.com","avatar":null},"body":">>>> Commit seems to be the wrong command as Git appears to be trying to do\n>>>> something I don't want.\n>>>>\n>>>> How do I force the push to succeed?\n>>>>\n>>>> Thanks in advance.\n>>>\n>>> Checkout the --force[-with-lease] argument.\n>\n> Thanks again Stefan,\n>\n> From another testing machine, it looks like the changes have not been\n> backed out. The previous operation un-did the ADX gear because it was\n> an evolutionary dead-end.\n>\n> via$ git pull\n> From https://github.com/noloader/cryptopp\n>  + 66654dd...559fc3b master     -> origin/master  (forced update)\n> Already up-to-date.\n> via:$ cat integer.cpp | grep ADX\n> #if defined(CRYPTOPP_ADX_AVAILABLE)\n> # define CRYPTOPP_INTEGER_ADX 1\n> #if CRYPTOPP_INTEGER_SSE2 || CRYPTOPP_INTEGER_ADX\n> #if CRYPTOPP_INTEGER_ADX\n> extern int CRYPTOPP_FASTCALL ADX_Add(size_t N, word *C, const word *A,\n> const word *B);\n> #if CRYPTOPP_INTEGER_ADX\n>         if (HasADX())\n>                 s_pAdd = &ADX_Add;\n> #if CRYPTOPP_INTEGER_SSE2 || CRYPTOPP_INTEGER_ADX\n>\n> Above, there should be no references to ADX. Looking at the GitHub the\n> changes have been applied.\n>\n> Any ideas?\n\nYou know, I look at how fucked up yet another simple workflow is, and\nall I can do is wonder. It is absolutely amazing. Its like the project\ngoes out of its way to make simple tasks difficult.\n"},{"id":"327011","messageId":"20170823080328.GE3839@alpha.vpn.ikke.info","threadId":"46653","inReplyTo":"CAH8yC8=A0-geqduTNNJw0yb1BREqsB75_bKSp+06Rb5fY6oiuQ@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2017-08-23T08:03:28Z","receivedAt":"2017-08-23T08:06:32Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Tue, Aug 22, 2017 at 05:55:25PM -0400, Jeffrey Walton wrote:\n> I tested some changes that lead to a dead end. The changes need to be\n> removed. The changes were added in 7 commits.\n> \n> I went back in time to the point before the changes:\n> \n>     $ git reset --hard HEAD~7\n>     HEAD is now at 559fc3b Fix benchmark selection code (GH #464)\n> \n> When I attempted to push:\n> \n>     $ git push\n>     Username for 'https://github.com': noloader\n>     To https://github.com/noloader/cryptopp.git\n>      ! [rejected]        master -> master (non-fast-forward)\n> \n> I tried to commit, but Git claims there's nothing to add:\n> \n>     $ git commit\n>     On branch master\n>     Your branch is behind 'origin/master' by 7 commits, and can be\n> fast-forwarded.\n> \n> Commit seems to be the wrong command as Git appears to be trying to do\n> something I don't want.\n> \n> How do I force the push to succeed?\n> \n> Thanks in advance.\n\nBy actually doing a force push:\n\n    git push --force-with-lease origin master\n\nBut note that this can interfere with others working on the same\nrepository, so be carefull when you use a force push.\n\nAdditionally, I can recommend using separate branches for things that\nmight turn up as dead ends (or even for every development). That way,\nyou can just throw away the branch if you want to discard it.\n\nHope this helps, Kevin.\n\n\n"},{"id":"327049","messageId":"20170823165634.GI13924@aiede.mtv.corp.google.com","threadId":"46653","inReplyTo":"CAH8yC8nHnbWTG4hxD+mEHKPS6eWcBb7yMsgN886=aTWaBRhE5A@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2017-08-23T16:56:34Z","receivedAt":"2017-08-23T16:56:46Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi Jeffrey,\n\nJeffrey Walton wrote:\n\n> From another testing machine, it looks like the changes have not been\n> backed out. The previous operation un-did the ADX gear because it was\n> an evolutionary dead-end.\n>\n> via$ git pull\n> From https://github.com/noloader/cryptopp\n>  + 66654dd...559fc3b master     -> origin/master  (forced update)\n\nThe Git User Manual[1] explains:\n\n| We have already seen how to keep remote-tracking branches up to date\n| with git-fetch(1), and how to merge two branches. So you can merge\n| in changes from the original repository’s master branch with:\n|\n| $ git fetch\n| $ git merge origin/master\n|\n| However, the git-pull(1) command provides a way to do this in one step:\n|\n| $ git pull origin master\n\nThere is also some discussion of that in \"git help pull\".\n\nBut that doesn't appear to be what you want to do.  You are not\nlooking to incorporate remote changes into your local branch,\npreserving any changes that are in your local branch --- instead, you\nare looking to move to what the remote server has, overwriting any\nchanges that are in your local branch.\n\nYou can do that with\n\n\tgit fetch\n\tgit reset --hard origin/master\n\nSee also the discussion of --force in \"git help push\".\n\nI also recommend looking at the Git Tutorial[2].  When it introduces\n\"git reset --hard\" to back out changes, it says:\n\n| $ git reset --hard HEAD^ # reset your current branch and working\n|                          # directory to its state at HEAD^\n|\n| Be careful with that last command: in addition to losing any changes\n| in the working directory, it will also remove all later commits from\n| this branch. If this branch is the only branch containing those\n| commits, they will be lost. Also, don’t use git reset on a\n| publicly-visible branch that other developers pull from, as it will\n| force needless merges on other developers to clean up the history.\n| If you need to undo changes that you have pushed, use git revert\n| instead.\n\nIf you have ideas about how it could explain this better (or even\nbetter, how commands could behave to avoid needing such explanation)\nthen I would be happy to hear them.\n\n(Side note: I am starting to wonder whether what you were looking for\nwas something like \"git revert\", especially if this is a project\ninvolving more than one person.)\n\n> You know, I look at how fucked up yet another simple workflow is, and\n> all I can do is wonder. It is absolutely amazing. Its like the project\n> goes out of its way to make simple tasks difficult.\n\nI understand your frustration, but accusing people of trying to make\nyour life difficult isn't a particularly productive way to get help\nfrom them.\n\nFor the future, some ways to get good results are\n\n- to describe the background of what you are trying to do\n- to describe where you looked for answers, so that we know what\n  documentation to improve\n\nThe #git IRC channel on freenode can also be helpful for real-time\nhelp.  But I encourage you to also keep writing here so that we know\nwhat documentation and workflows to improve.\n\nThanks and hope that helps,\nJonatha\n\n[1] https://www.kernel.org/pub/software/scm/git/docs/user-manual.html#getting-updates-With-git-pull\n[2] https://www.kernel.org/pub/software/scm/git/docs/gittutorial.html\n"},{"id":"327050","messageId":"6d9c7dd4-f1ad-8f5b-1e7b-2dcc5b9baf7e@kdbg.org","threadId":"46653","inReplyTo":"CAH8yC8=HuAZ0tJbRGnp83-Th5OkQ0-cdSOBrMU23y6NyB0Ax3g@mail.gmail.com","subject":"Re: How to force a push to succeed?","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2017-08-23T17:06:51Z","receivedAt":"2017-08-23T17:06:59Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 23.08.2017 um 00:26 schrieb Jeffrey Walton:\n> You know, I look at how fucked up yet another simple workflow is, and\n> all I can do is wonder. It is absolutely amazing. Its like the project\n> goes out of its way to make simple tasks difficult.\n\nNo, no. So simple your task might look, in the end you have LOST DATA! \nIt is a design goal of Git to make it difficult to lose data.\n\n-- Hannes\n"}]}