Restoring a lost svn history for a git project
I have a project, that was migrated from SVN to git some time ago.
WELL. Not really migrated. The last SVN revision was copied into the initial git commit. So basically all SVN history was squashed into the first git commit.
Many commits have now been added to the git repository.
Is there a way to way to rebase the new git commits onto a properly converted git repo? So we have the full history again?
Edit:
I now have two git branches, one with all the old history (old
), another with all the new history (new
). There is no diff between the last commit of old
and the first commit of new
. How do I merge those histories into one?
git svn git-svn
add a comment |
I have a project, that was migrated from SVN to git some time ago.
WELL. Not really migrated. The last SVN revision was copied into the initial git commit. So basically all SVN history was squashed into the first git commit.
Many commits have now been added to the git repository.
Is there a way to way to rebase the new git commits onto a properly converted git repo? So we have the full history again?
Edit:
I now have two git branches, one with all the old history (old
), another with all the new history (new
). There is no diff between the last commit of old
and the first commit of new
. How do I merge those histories into one?
git svn git-svn
add a comment |
I have a project, that was migrated from SVN to git some time ago.
WELL. Not really migrated. The last SVN revision was copied into the initial git commit. So basically all SVN history was squashed into the first git commit.
Many commits have now been added to the git repository.
Is there a way to way to rebase the new git commits onto a properly converted git repo? So we have the full history again?
Edit:
I now have two git branches, one with all the old history (old
), another with all the new history (new
). There is no diff between the last commit of old
and the first commit of new
. How do I merge those histories into one?
git svn git-svn
I have a project, that was migrated from SVN to git some time ago.
WELL. Not really migrated. The last SVN revision was copied into the initial git commit. So basically all SVN history was squashed into the first git commit.
Many commits have now been added to the git repository.
Is there a way to way to rebase the new git commits onto a properly converted git repo? So we have the full history again?
Edit:
I now have two git branches, one with all the old history (old
), another with all the new history (new
). There is no diff between the last commit of old
and the first commit of new
. How do I merge those histories into one?
git svn git-svn
git svn git-svn
edited Nov 13 '18 at 15:14
asked Nov 12 '18 at 15:52
MaxNoe
7,91622531
7,91622531
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
With a little work, sure. First, migrate correctly the svn repo into a git repo. Then add the git repo that you created from svn before (bad-remote, from now on) as a remote. When you fetch from it, you will be able to see the remote branches from bad-remote. Then rebase (or cherry-pick, whavever you think will be fine) the work that you did on bad-remote on top of the new svn branches on this repo.
git rebase --onto svn-full-history svn-short-history-first-revision-id svn-short-with-git-only-commits
That should apply all the git-only changes onto the full svn branch.
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit ofold
and the first commit ofnew
. How do I merge those histories into one?
– MaxNoe
Nov 13 '18 at 15:13
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
You could try to replicate the merges with --rebase-merges or --preserve-merges.git help rebase
will provide you will all the gory details (including a full section on rebasing merges).
– eftshift0
Nov 13 '18 at 16:25
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265684%2frestoring-a-lost-svn-history-for-a-git-project%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
With a little work, sure. First, migrate correctly the svn repo into a git repo. Then add the git repo that you created from svn before (bad-remote, from now on) as a remote. When you fetch from it, you will be able to see the remote branches from bad-remote. Then rebase (or cherry-pick, whavever you think will be fine) the work that you did on bad-remote on top of the new svn branches on this repo.
git rebase --onto svn-full-history svn-short-history-first-revision-id svn-short-with-git-only-commits
That should apply all the git-only changes onto the full svn branch.
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit ofold
and the first commit ofnew
. How do I merge those histories into one?
– MaxNoe
Nov 13 '18 at 15:13
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
You could try to replicate the merges with --rebase-merges or --preserve-merges.git help rebase
will provide you will all the gory details (including a full section on rebasing merges).
– eftshift0
Nov 13 '18 at 16:25
|
show 2 more comments
With a little work, sure. First, migrate correctly the svn repo into a git repo. Then add the git repo that you created from svn before (bad-remote, from now on) as a remote. When you fetch from it, you will be able to see the remote branches from bad-remote. Then rebase (or cherry-pick, whavever you think will be fine) the work that you did on bad-remote on top of the new svn branches on this repo.
git rebase --onto svn-full-history svn-short-history-first-revision-id svn-short-with-git-only-commits
That should apply all the git-only changes onto the full svn branch.
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit ofold
and the first commit ofnew
. How do I merge those histories into one?
– MaxNoe
Nov 13 '18 at 15:13
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
You could try to replicate the merges with --rebase-merges or --preserve-merges.git help rebase
will provide you will all the gory details (including a full section on rebasing merges).
– eftshift0
Nov 13 '18 at 16:25
|
show 2 more comments
With a little work, sure. First, migrate correctly the svn repo into a git repo. Then add the git repo that you created from svn before (bad-remote, from now on) as a remote. When you fetch from it, you will be able to see the remote branches from bad-remote. Then rebase (or cherry-pick, whavever you think will be fine) the work that you did on bad-remote on top of the new svn branches on this repo.
git rebase --onto svn-full-history svn-short-history-first-revision-id svn-short-with-git-only-commits
That should apply all the git-only changes onto the full svn branch.
With a little work, sure. First, migrate correctly the svn repo into a git repo. Then add the git repo that you created from svn before (bad-remote, from now on) as a remote. When you fetch from it, you will be able to see the remote branches from bad-remote. Then rebase (or cherry-pick, whavever you think will be fine) the work that you did on bad-remote on top of the new svn branches on this repo.
git rebase --onto svn-full-history svn-short-history-first-revision-id svn-short-with-git-only-commits
That should apply all the git-only changes onto the full svn branch.
edited Nov 13 '18 at 16:04
answered Nov 12 '18 at 16:21
eftshift0
4,454918
4,454918
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit ofold
and the first commit ofnew
. How do I merge those histories into one?
– MaxNoe
Nov 13 '18 at 15:13
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
You could try to replicate the merges with --rebase-merges or --preserve-merges.git help rebase
will provide you will all the gory details (including a full section on rebasing merges).
– eftshift0
Nov 13 '18 at 16:25
|
show 2 more comments
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit ofold
and the first commit ofnew
. How do I merge those histories into one?
– MaxNoe
Nov 13 '18 at 15:13
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
You could try to replicate the merges with --rebase-merges or --preserve-merges.git help rebase
will provide you will all the gory details (including a full section on rebasing merges).
– eftshift0
Nov 13 '18 at 16:25
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit of
old
and the first commit of new
. How do I merge those histories into one?– MaxNoe
Nov 13 '18 at 15:13
I now have two git branches, one with all the old history, another with all the new history. There is no diff between the last commit of
old
and the first commit of new
. How do I merge those histories into one?– MaxNoe
Nov 13 '18 at 15:13
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
I'm not sure I quite understood. If I'm not mistaken what you mean is that you have fetched the full history of the svn branch (only working on a single svn branch, right?).. which I would assume I meant to call new and then you can also see on this repo the git repository with the old sv branch plus a lot of work done on git and not on svn, which I would assume you would call old. You have compared the first revision of old (which is the last revision of the project taken from svn) with the last revision of new (which is the branch with the full story) and they are both the same
– eftshift0
Nov 13 '18 at 16:01
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
The next step would then be to ask git to put the git-only history of the old repo onto the new svn branch, right? I'll add the recipe on my original answer
– eftshift0
Nov 13 '18 at 16:02
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
This would work, if the new git history is just linear. However there are tons of merges and resolved conflicts git know wants to have resolved again
– MaxNoe
Nov 13 '18 at 16:13
You could try to replicate the merges with --rebase-merges or --preserve-merges.
git help rebase
will provide you will all the gory details (including a full section on rebasing merges).– eftshift0
Nov 13 '18 at 16:25
You could try to replicate the merges with --rebase-merges or --preserve-merges.
git help rebase
will provide you will all the gory details (including a full section on rebasing merges).– eftshift0
Nov 13 '18 at 16:25
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265684%2frestoring-a-lost-svn-history-for-a-git-project%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown