Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to "bake in" replace references #82

Open
mhagger opened this issue Feb 19, 2015 · 3 comments
Open

Add ability to "bake in" replace references #82

mhagger opened this issue Feb 19, 2015 · 3 comments

Comments

@mhagger
Copy link

mhagger commented Feb 19, 2015

Within Git itself, you can use "replace" references to cause it to use one object in place of another. This facility has gotten more powerful lately with

  • git replace --edit -- rewrite an object interactively by editing its text representation
  • git replace --graft -- rewrite a commit to have different parents

It would be nice to be able to "bake in" such replacements, making the substitutions a part of the permanent Git history. Then, for example, one could do fixups interactively via replace references, and then bake them in to make the changes permanent. "Baking in" obviously involves percolating the substitutions upwards to the branch tips, something that BFG must already have code to do.

Would it be hard to teach BFG to bake replace refences in? I think it would be a great feature!

Edited to fix git commands

@HelgeBoehme
Copy link

Looks like, this is still not possible. I want to do something like:
git filter-branch --prune-empty -- --all
But this option doesn't exist for bfg and I don't see similar options. And a plain rewrite without further changes seems to be also not possible:

$ java -jar ./bfg-1.13.0.jar .git
Using repo : ./.git
Please specify tasks for The BFG :
[...]

@javabrett
Copy link
Contributor

@mhagger possible that your issue text refers to syntax git rewrite ... where it should be git replace ....

replace is a strange one - IIRC it requires non-default or periodic special local fetch configuration to pull refs/replace in order to work.

I wonder how JGit handles replacements.

@HelgeBoehme see PR #147 for a --prune-empty option.

@mhagger
Copy link
Author

mhagger commented Sep 4, 2018

@javabrett Yes, I meant git replace. I just fixed my comment.

I'm not sure that you want to use replace references permanently. Aside from requiring all repository users to do special configuration, it's also nonconventional and you're therefore more likely to run into bugs and edge cases. If at all possible, I'd suggest using replace references temporarily while in the process of rewriting your history, then getting rid of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants