On Fri, Nov 26, 2021 at 07:02:06PM +0100, Uwe Brauer wrote: > A couple of minutes ago I screwed up a repository at sourceforge. > > In my machine it reads > > commit 89346f81fef27286bd3fb1ed3ddc94a6f3fb560d (origin/copyright, > origin/copy) > | Author: Uwe Brauer <o...@mat.ucm.es> > | Date: Thu Nov 25 10:43:56 2021 +0100 > | > | Add patches to my new branch > | > | --HG-- > | branch : copyright > | > * commit 66380013003549a6851d4e110b29a5a439e05609 > | Author: Uwe Brauer <o...@mat.ucm.es> > | Date: Mon Nov 22 21:51:13 2021 +0100 > | > | Add patches to a special, named branch! > | > | --HG-- > | branch : copyright > | > * commit c945bf50251150e0d4ad7ee751c7e9615cb4b3e8 (origin/master, origin/HEAD) > | Author: Uwe Brauer <o...@mat.ucm.es> > | Date: Mon Nov 22 09:33:48 2021 +0100 > | > | Correct a silly typo in company-matlab-shell.el > | > | * company-matlab-shell.el: 677 correct a silly typo: Auctex should be > Matlab > > > The first two commits I should have pushed.
What are the first two? The two at the bottom - so that these are c945bf50251 and 66380013003? If yes, then it's simple: do $ git push -f origin 66380013003:master which means telling remote Git to make its "master" branch point at commit 66380013003; "-f" tells it to ignore that "non-fast-forward" condition. IoW the specification WITH:WHAT tells remote Git to update WHAT with WITH. If pushing still fails, it means that SF might have some (non-standard) "protection" of the branch "master". I'd then checked the project's settings. > I read in > https://stackoverflow.com/questions/3293531/how-to-permanently-remove-few-commits-from-remote-branch > > I should run > > git reset --hard c945b^ I'm not quite sure what this would achieve: it basically asks the local Git to make the currently checked out branch to point at the first parent of the commit c945bf50 - throwing away what was committed on top (these commits could be easily recovered, just in case). >From the beginning of your message I would say this is not what is needed. > git push --force > > But I receive then > > git push --force > Warning: Permanently added 'git.code.sf.net,216.105.38.16' (ECDSA) to the > list of known hosts. > Total 0 (delta 0), reused 0 (delta 0) > remote: error: denying non-fast-forward refs/heads/master (you should pull > first) > To git+ssh://o...@git.code.sf.net/p/matlab-emacs/src > ! [remote rejected] master -> master (non-fast-forward) > error: failed to push some refs to > 'git+ssh://o...@git.code.sf.net/p/matlab-emacs/src' > > I still hope I can repair that mess before anybody notes... > > Any help would be strongly appreciated. Looks indeed like some sort of protection. Unfortunately, it's been a while since I used SF as a developer so I cannot tell for sure. [1] suggests SF does not have this feature, so please try what I've suggested above (but please verify you select a correct commit to become the tip commit of the remote "master" branch). 1. https://sourceforge.net/p/forge/feature-requests/634/ -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/git-users/20211126192209.ty2ilbkdbv6hghu2%40carbon.