Reputation: 3362
I am in a Git repository, and in my branch there are some commits. I need to push only this branch's changes into another remote repository. How can I achieve this?
I have tried the command git push [email protected]:XXX/XXX.git launchpad-issues
.
This command pushes the whole repository, but I am looking to just push the changes on one branch only.
Upvotes: 0
Views: 651
Reputation: 4161
You can add another remote to your local git and then push to it. Say you want to push the foo
branch
# Add another remote called 'my-other-repo'
git remote add my-other-repo [email protected]:XXX/XXX.git
# Push the foo branch to my-other-repo
git push my-other-repo foo
And if you want you can optionally remove the remote afterward
git remote remove my-other-repo
Upvotes: 1