views:

431

answers:

1

I have to rewrite the history of my repository because it contains some credentials. As I have to amend the root commit I followed the instructions from Git Faq. My problem is though that I have two branches and several tags already in the repository and I'd like that my history rewrite to apply to those too. The repo isn't public yet, so that wouldn't be a problem. I've asked a similar question before, but in that case the git rebase command was not used. Here's a basic graph of my repo:

+  master branch
|
|   + topic branch
|   |
|   |
+---+
|
|
|
+  TAG
|
+  Initial commit, the commit I'd like to amend for all branches

Is it even possible?

+4  A: 

Use "git filter-branch" instead of git-rebase.

If you really, really feel that rebase would be better, with modern git you can use --root option to git-rebase. Or cherry-pick root commit, and then rebase on top of it, if you have older git that doesn't have this option.

Jakub Narębski
Thanks Jakub. But I'm not really sure how `filter-branch` will help me. I have to edit code in almost 10 files, so that I pretend that the first commit had no credentials in it. I don't know how would that be possible because there's no standard format for those files. It's just code. I think it would be possible using `--tree-filter`, but seems way to complicated to parse the code.
Ionuț G. Stan
Jakub Narębski
Thanks, I'll try them both, although the second option seems easier. Greatly appreciated.
Ionuț G. Stan