Push repository to new remote, one commit at the time
I'm moving a repository to a new host, and for unfortunate historal reasons, a lot of large files are checked in (cocoa pods, images)
While I've used Git BFS to reduce the size to 940mb (from 2.4GB), it's still not enough to support the push to our internal deployment of BitBucket server.
So I'd like to push the commits one by one, from a specific point in history. The repository was originally ported from SVN, and broke the Git tree at that point in time (there's a graph that have a solid break about 5 years back)
It's only 4000 commits, so it's a reasonable amount to push one by one, but I can't find a good way to push from a given ref, rather than to a given ref.
So, is there any way to push from commit-hash to commit-hash (in my case, HEAD) to a (new) remote endpoint?
git bitbucket-server
add a comment |
I'm moving a repository to a new host, and for unfortunate historal reasons, a lot of large files are checked in (cocoa pods, images)
While I've used Git BFS to reduce the size to 940mb (from 2.4GB), it's still not enough to support the push to our internal deployment of BitBucket server.
So I'd like to push the commits one by one, from a specific point in history. The repository was originally ported from SVN, and broke the Git tree at that point in time (there's a graph that have a solid break about 5 years back)
It's only 4000 commits, so it's a reasonable amount to push one by one, but I can't find a good way to push from a given ref, rather than to a given ref.
So, is there any way to push from commit-hash to commit-hash (in my case, HEAD) to a (new) remote endpoint?
git bitbucket-server
I don't know of any way to push a commit directly but you might be able to create a new temporary branch, which you can reset to a commit, push the branch, reset it to the next commit, push it, and so on, until you're at master's commit, at which point you'd just have to push master and delete the temporary branch.
– tkausl
Nov 21 '18 at 19:33
@tkauslgit push origin HEAD~1:refs/head/master
will push the commit before the current one to origin/master (and only that commit), but it doesn't work for a range of commits :/ So essentially I'm looking for a smart way of doing this for a full range.
– Claus Jørgensen
Nov 21 '18 at 19:44
Right, I forgot aboutfrom:to
syntax... Well even if it doesn't work with a range, you could write a simple script to push one commit at a time.git log --pretty=format:"%h" --reverse origin/master..master
gives you a list of commits origin/master is missing, iterate over them and push them one at a time.
– tkausl
Nov 21 '18 at 19:50
add a comment |
I'm moving a repository to a new host, and for unfortunate historal reasons, a lot of large files are checked in (cocoa pods, images)
While I've used Git BFS to reduce the size to 940mb (from 2.4GB), it's still not enough to support the push to our internal deployment of BitBucket server.
So I'd like to push the commits one by one, from a specific point in history. The repository was originally ported from SVN, and broke the Git tree at that point in time (there's a graph that have a solid break about 5 years back)
It's only 4000 commits, so it's a reasonable amount to push one by one, but I can't find a good way to push from a given ref, rather than to a given ref.
So, is there any way to push from commit-hash to commit-hash (in my case, HEAD) to a (new) remote endpoint?
git bitbucket-server
I'm moving a repository to a new host, and for unfortunate historal reasons, a lot of large files are checked in (cocoa pods, images)
While I've used Git BFS to reduce the size to 940mb (from 2.4GB), it's still not enough to support the push to our internal deployment of BitBucket server.
So I'd like to push the commits one by one, from a specific point in history. The repository was originally ported from SVN, and broke the Git tree at that point in time (there's a graph that have a solid break about 5 years back)
It's only 4000 commits, so it's a reasonable amount to push one by one, but I can't find a good way to push from a given ref, rather than to a given ref.
So, is there any way to push from commit-hash to commit-hash (in my case, HEAD) to a (new) remote endpoint?
git bitbucket-server
git bitbucket-server
asked Nov 21 '18 at 19:31


Claus JørgensenClaus Jørgensen
22.2k969125
22.2k969125
I don't know of any way to push a commit directly but you might be able to create a new temporary branch, which you can reset to a commit, push the branch, reset it to the next commit, push it, and so on, until you're at master's commit, at which point you'd just have to push master and delete the temporary branch.
– tkausl
Nov 21 '18 at 19:33
@tkauslgit push origin HEAD~1:refs/head/master
will push the commit before the current one to origin/master (and only that commit), but it doesn't work for a range of commits :/ So essentially I'm looking for a smart way of doing this for a full range.
– Claus Jørgensen
Nov 21 '18 at 19:44
Right, I forgot aboutfrom:to
syntax... Well even if it doesn't work with a range, you could write a simple script to push one commit at a time.git log --pretty=format:"%h" --reverse origin/master..master
gives you a list of commits origin/master is missing, iterate over them and push them one at a time.
– tkausl
Nov 21 '18 at 19:50
add a comment |
I don't know of any way to push a commit directly but you might be able to create a new temporary branch, which you can reset to a commit, push the branch, reset it to the next commit, push it, and so on, until you're at master's commit, at which point you'd just have to push master and delete the temporary branch.
– tkausl
Nov 21 '18 at 19:33
@tkauslgit push origin HEAD~1:refs/head/master
will push the commit before the current one to origin/master (and only that commit), but it doesn't work for a range of commits :/ So essentially I'm looking for a smart way of doing this for a full range.
– Claus Jørgensen
Nov 21 '18 at 19:44
Right, I forgot aboutfrom:to
syntax... Well even if it doesn't work with a range, you could write a simple script to push one commit at a time.git log --pretty=format:"%h" --reverse origin/master..master
gives you a list of commits origin/master is missing, iterate over them and push them one at a time.
– tkausl
Nov 21 '18 at 19:50
I don't know of any way to push a commit directly but you might be able to create a new temporary branch, which you can reset to a commit, push the branch, reset it to the next commit, push it, and so on, until you're at master's commit, at which point you'd just have to push master and delete the temporary branch.
– tkausl
Nov 21 '18 at 19:33
I don't know of any way to push a commit directly but you might be able to create a new temporary branch, which you can reset to a commit, push the branch, reset it to the next commit, push it, and so on, until you're at master's commit, at which point you'd just have to push master and delete the temporary branch.
– tkausl
Nov 21 '18 at 19:33
@tkausl
git push origin HEAD~1:refs/head/master
will push the commit before the current one to origin/master (and only that commit), but it doesn't work for a range of commits :/ So essentially I'm looking for a smart way of doing this for a full range.– Claus Jørgensen
Nov 21 '18 at 19:44
@tkausl
git push origin HEAD~1:refs/head/master
will push the commit before the current one to origin/master (and only that commit), but it doesn't work for a range of commits :/ So essentially I'm looking for a smart way of doing this for a full range.– Claus Jørgensen
Nov 21 '18 at 19:44
Right, I forgot about
from:to
syntax... Well even if it doesn't work with a range, you could write a simple script to push one commit at a time. git log --pretty=format:"%h" --reverse origin/master..master
gives you a list of commits origin/master is missing, iterate over them and push them one at a time.– tkausl
Nov 21 '18 at 19:50
Right, I forgot about
from:to
syntax... Well even if it doesn't work with a range, you could write a simple script to push one commit at a time. git log --pretty=format:"%h" --reverse origin/master..master
gives you a list of commits origin/master is missing, iterate over them and push them one at a time.– tkausl
Nov 21 '18 at 19:50
add a comment |
1 Answer
1
active
oldest
votes
As I suggested in the comments, a little script to push one commit at a time might work. From the server's point of view it would look like one were working on the project, commiting and pushing continuously.
In bash, this should work:
for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do
git push origin $c:master
done
--first-parent
is needed so it doesn't break on merge's. I tried it locally and this is what I got:
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --graph --decorate
* d2d3264 (HEAD -> master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc (origin/master) initial commit
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --pretty=format:"%h" --reverse --first-parent origin/master..master
6765170
ca354e5
f3c54df
9171144
d2d3264
tobi@TOBIAS-PC:/mnt/d/test/git/r$ for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do git push origin $c:master; done
Counting objects: 3, done.
Writing objects: 100% (3/3), 235 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
c1873cc..6765170 6765170 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
6765170..ca354e5 ca354e5 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
ca354e5..f3c54df f3c54df -> master
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 762 bytes | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To ../b
f3c54df..9171144 9171144 -> master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
9171144..d2d3264 d2d3264 -> master
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --decorate --graph
* d2d3264 (HEAD -> master, origin/master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc initial commit
You might also want to add a sleep in case the server gets overwhelmed by all these pushes to give it some time to process all this data; I don't really know whether it does anything further than just storing it on the disk, it might index it or something.
add a comment |
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%2f53419308%2fpush-repository-to-new-remote-one-commit-at-the-time%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
As I suggested in the comments, a little script to push one commit at a time might work. From the server's point of view it would look like one were working on the project, commiting and pushing continuously.
In bash, this should work:
for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do
git push origin $c:master
done
--first-parent
is needed so it doesn't break on merge's. I tried it locally and this is what I got:
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --graph --decorate
* d2d3264 (HEAD -> master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc (origin/master) initial commit
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --pretty=format:"%h" --reverse --first-parent origin/master..master
6765170
ca354e5
f3c54df
9171144
d2d3264
tobi@TOBIAS-PC:/mnt/d/test/git/r$ for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do git push origin $c:master; done
Counting objects: 3, done.
Writing objects: 100% (3/3), 235 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
c1873cc..6765170 6765170 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
6765170..ca354e5 ca354e5 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
ca354e5..f3c54df f3c54df -> master
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 762 bytes | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To ../b
f3c54df..9171144 9171144 -> master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
9171144..d2d3264 d2d3264 -> master
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --decorate --graph
* d2d3264 (HEAD -> master, origin/master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc initial commit
You might also want to add a sleep in case the server gets overwhelmed by all these pushes to give it some time to process all this data; I don't really know whether it does anything further than just storing it on the disk, it might index it or something.
add a comment |
As I suggested in the comments, a little script to push one commit at a time might work. From the server's point of view it would look like one were working on the project, commiting and pushing continuously.
In bash, this should work:
for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do
git push origin $c:master
done
--first-parent
is needed so it doesn't break on merge's. I tried it locally and this is what I got:
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --graph --decorate
* d2d3264 (HEAD -> master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc (origin/master) initial commit
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --pretty=format:"%h" --reverse --first-parent origin/master..master
6765170
ca354e5
f3c54df
9171144
d2d3264
tobi@TOBIAS-PC:/mnt/d/test/git/r$ for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do git push origin $c:master; done
Counting objects: 3, done.
Writing objects: 100% (3/3), 235 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
c1873cc..6765170 6765170 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
6765170..ca354e5 ca354e5 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
ca354e5..f3c54df f3c54df -> master
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 762 bytes | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To ../b
f3c54df..9171144 9171144 -> master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
9171144..d2d3264 d2d3264 -> master
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --decorate --graph
* d2d3264 (HEAD -> master, origin/master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc initial commit
You might also want to add a sleep in case the server gets overwhelmed by all these pushes to give it some time to process all this data; I don't really know whether it does anything further than just storing it on the disk, it might index it or something.
add a comment |
As I suggested in the comments, a little script to push one commit at a time might work. From the server's point of view it would look like one were working on the project, commiting and pushing continuously.
In bash, this should work:
for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do
git push origin $c:master
done
--first-parent
is needed so it doesn't break on merge's. I tried it locally and this is what I got:
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --graph --decorate
* d2d3264 (HEAD -> master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc (origin/master) initial commit
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --pretty=format:"%h" --reverse --first-parent origin/master..master
6765170
ca354e5
f3c54df
9171144
d2d3264
tobi@TOBIAS-PC:/mnt/d/test/git/r$ for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do git push origin $c:master; done
Counting objects: 3, done.
Writing objects: 100% (3/3), 235 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
c1873cc..6765170 6765170 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
6765170..ca354e5 ca354e5 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
ca354e5..f3c54df f3c54df -> master
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 762 bytes | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To ../b
f3c54df..9171144 9171144 -> master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
9171144..d2d3264 d2d3264 -> master
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --decorate --graph
* d2d3264 (HEAD -> master, origin/master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc initial commit
You might also want to add a sleep in case the server gets overwhelmed by all these pushes to give it some time to process all this data; I don't really know whether it does anything further than just storing it on the disk, it might index it or something.
As I suggested in the comments, a little script to push one commit at a time might work. From the server's point of view it would look like one were working on the project, commiting and pushing continuously.
In bash, this should work:
for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do
git push origin $c:master
done
--first-parent
is needed so it doesn't break on merge's. I tried it locally and this is what I got:
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --graph --decorate
* d2d3264 (HEAD -> master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc (origin/master) initial commit
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --pretty=format:"%h" --reverse --first-parent origin/master..master
6765170
ca354e5
f3c54df
9171144
d2d3264
tobi@TOBIAS-PC:/mnt/d/test/git/r$ for c in $(git log --pretty=format:"%h" --reverse --first-parent origin/master..master); do git push origin $c:master; done
Counting objects: 3, done.
Writing objects: 100% (3/3), 235 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
c1873cc..6765170 6765170 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
6765170..ca354e5 ca354e5 -> master
Counting objects: 3, done.
Writing objects: 100% (3/3), 244 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
ca354e5..f3c54df f3c54df -> master
Counting objects: 8, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 762 bytes | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To ../b
f3c54df..9171144 9171144 -> master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 274 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To ../b
9171144..d2d3264 d2d3264 -> master
tobi@TOBIAS-PC:/mnt/d/test/git/r$ git log --oneline --decorate --graph
* d2d3264 (HEAD -> master, origin/master) asdaskdj
* 9171144 Merge branch 'something'
|
| * f85e25e (something) opjsdfk
| * 069b6f1 bla
* | f3c54df kjsdaflk
* | ca354e5 kjsdaflk
|/
* 6765170 asdf
* c1873cc initial commit
You might also want to add a sleep in case the server gets overwhelmed by all these pushes to give it some time to process all this data; I don't really know whether it does anything further than just storing it on the disk, it might index it or something.
edited Nov 21 '18 at 20:21
answered Nov 21 '18 at 20:15
tkausltkausl
8,52412242
8,52412242
add a comment |
add a comment |
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.
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%2f53419308%2fpush-repository-to-new-remote-one-commit-at-the-time%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
I don't know of any way to push a commit directly but you might be able to create a new temporary branch, which you can reset to a commit, push the branch, reset it to the next commit, push it, and so on, until you're at master's commit, at which point you'd just have to push master and delete the temporary branch.
– tkausl
Nov 21 '18 at 19:33
@tkausl
git push origin HEAD~1:refs/head/master
will push the commit before the current one to origin/master (and only that commit), but it doesn't work for a range of commits :/ So essentially I'm looking for a smart way of doing this for a full range.– Claus Jørgensen
Nov 21 '18 at 19:44
Right, I forgot about
from:to
syntax... Well even if it doesn't work with a range, you could write a simple script to push one commit at a time.git log --pretty=format:"%h" --reverse origin/master..master
gives you a list of commits origin/master is missing, iterate over them and push them one at a time.– tkausl
Nov 21 '18 at 19:50