Reputation: 5929
I made a commit to my local repository that was not integrated into the remote repository. Now lots of work has been done on the remote repository, and when I do a "git pull", I have tons of staged changes now because they fail to merge automatically with my lone, local commit.
Is there a way to look at the most current revision on the remote branch and manually merge my commit into it? Reading about cherry-pick and rebase I cannot decide if they apply to my situation. I could do a fresh checkout of the project, and then copy/paste my code changes from one repo to another but I want to hear the correct way of doing it in case I have a larger commit in the future.
Upvotes: 0
Views: 54
Reputation: 21249
First, save your current work in another local branch not to loose it.
git checkout -b i-would-never-commit-to-develop-locally
Then, synchronize your local develop
with the remote.
git fetch -f origin develop:develop
Rebase your branch to the develop
.
git rebase develop
It is likely that you would have to resolve some conflicts here.
Finally, push your commit to the remote.
git push origin HEAD:remote-target-branch
Upvotes: 1