Issue #23 resolved

It fails to recognize non-fast-forward issues

José Araujo
created an issue

See full description of the issue here:

I believe it is bad because you get no notification of the issue, so there is no way somebody would manually reinitialize the backup folders.

Comments (7)

  1. Christian Specht repo owner

    Before I merge a pull request, I usually test it first on my machine.

    I'd like to test your pull request as well, but I don't really know Git (read this to see where I'm coming from), so I'm not really familiar with rebasing, fast-forward and all that stuff.

    Can you give me the steps (= Git commands) to reproduce the issue?

  2. José Araujo reporter

    In order to reproduce the issue you need to download twice a repository. I recommend you clone any GIT repository to your account so you can test (the repository will be damaged, so you cannot use just any repository).

    1. Create a GIT repository for testing (any repository, just add a readme.txt and a readme2.txt files in the root of it).
    2. Create folder in your computer and cd into it:
      1. Mkdir c:\scratch\gittest.bare\
      2. Cd c:\scratch\gittest.bare.
    3. Bare init the folder: git init –bare.
    4. Fetch the repository: git fetch @repository_url refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*
    5. Create another folder, eg: c:\scratch\gittest.rebased and cd into it.
    6. Clone the repository into it: git clone @repository_url.
    7. Rebase/rewrite history: 1.Run the command below – it will delete the readme.txt. More information about what the command does:
      1. At this point you have ‘rebased’ your local copy.
    8. Push: git push –f.
      1. At this point you have pushed your rebased code to bitbucket.
    9. Go back to first folder (eg: cd c:\scratch\gittest.bare).
    10. Test that fetch now doesn’t work: git fetch @repository_url refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*
      1. You’ll get the error about the fast_foward.
    11. Test that fetch with my workaround works: git fetch –force –prune @repository_url refs/heads/*:refs/heads/* refs/tags/*:refs/tags/*

    Note: I didn’t test these steps myself (don’t have the environment here). If you have issues, please let me know.

    Command to delete file from history:

     git filter-branch --force --index-filter \
     'git rm --cached --ignore-unmatch readme.txt' \
      --prune-empty --tag-name-filter cat -- --all 
  3. Log in to comment