Undo git push to Assembla
Asked Answered
A

2

4

So - today I wanted to do a good thing and rearrange files in my repository. Committed and pushed up to my Assembla repository.

The situation in GIT GUI

Since I did not use the git moving command, all files lost their history. I realized my mistake and wanted to get rid of the unneeded changing so I could make the right kind of move afterwards. I tried the approach, showed in here, but instead I got:

$ git push -f origin 49bcfdceb30a1e9cfab0f0e7e39bfa04dc726b78:master
Total 0 (delta 0), reused 0 (delta 0)
remote: error: denying non-fast-forward refs/heads/master (you should pull first)
To [email protected]:myproject.git
 ! [remote rejected] 49bcfdceb30a1e9cfab0f0e7e39bfa04dc726b78 -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:myproject.git'

Info:

% 49bcfdceb30a1e9cfab0f0e7e39bfa04dc726b78 is the one tagged 'beforerearrange'

Any suggestions on how to fix this problem?

Aloeswood answered 12/11, 2012 at 13:22 Comment(2)
git mv is just a shortcut for moving the file, removing the old name from the repository and adding the new name. Whether or not you use that will not affect if git has history information for your files. git doesn't actually record any file renaming in any case, it deduces that later when you look at the history.Formenti
@Formenti - I thought so too until I noticed that when you perform git mv -f -k source.m destfolder/folder, git status -s gives rename rather than delete and create nodes.Aloeswood
A
13

When asked, I had no idea it could be connected with restrictions of Assembla.

Since this is a one time deal, I choose the following method that worked:

Citing the last comment from Assembla in the link (now obsolete but you can still find it in way back machine) mentioned by @michael-mior There is now an option “Allow force push” in the Git-Settings page, so

  1. Go to Assembla.com
  2. Go to your project -> Source/Git -> Settings
  3. Check the check-box "Allow --force push"
  4. Force push the right node:

    git push -f origin 49bcfdceb30a1e9cfab0f0e7e39bfa04dc726b78:master
    
  5. Clean up local mess.
  6. Go back to Assembla.com and disable "Allow --force push"

Result:

enter image description here

Aloeswood answered 12/11, 2012 at 14:52 Comment(0)
C
2

It seems Assembla denies forced pushes. (This thread suggests you have to contact support.)

Since it's just a few commits, your best option is probably just to use git revert to undo them all in turn.

Container answered 12/11, 2012 at 14:4 Comment(1)
you can add force pushes from your Repository settings page.Appetizer

© 2022 - 2024 — McMap. All rights reserved.