![]() Git rebase your "feature" branch onto your local copy of master. If all goes well, it'll do a fast-forward merge. Roll back your local master to the most recent commit that is both on the remote and local. Make two temporary branches on top of where your current work currently is - one will be effectively a "feature branch" that you're going to rebase, the other will be just ensuring an untouched copy of your local commits stay in the tree as they are now so that you don't lose work if you make a mistake (we'll refer to that as "backup" for now). ![]() I highly recommend doing what telfoid suggested, but with a minor change: What you're asking is a fundamentally weird way to resolve the actually relatively common problem of a local work being done on a less-than-up-to-date master. But it smells a lot like an X-Y problem (that is, you're asking about X, but the problem is actually a more fundamental Y that you haven't analysed properly - you've assumed X is the most viable solution as a result of misidentifying the problem). What you're suggesting is technically possible, by making a temp branch for your local work, rolling back your local master, then pulling, and then some further tricky work. Git pull is, effectively, git fetch followed by git merge. An alternative could be to perhaps use git rebase -i` in my local branch to rebase back to the last commit in which both branches were in-sync, then re-execute each commit, one by one, and manually resolve any issues that arise with each. I was hoping that after I re-pulled each remote commit in this manner, both branches would be in-sync. Then in my local branch, I could hopefully re-pull each commit from the remote branch, one-by-one, and manually resolve any issues that may arise. So I thought one viable option might be to carry out a hard reset of my local branch, back to the last commit in which both branches were in-sync. I would like to bring them back into sync and ensure my local branch is an ancestor of the remote branch. In addition, my local branch is no longer an ancestor of the remote branch. My local branch should be in-sync with my remote branch, but it has become out of sync ( Your branch is ahead of 'origin/master' by 7 commits.). The goal here is to resolve particular issue. If my local repo is behind my remote repo by three commits, is it possible to pull each of those commits to my local repo, one by one? I believe git pull will fetch all three commits and merge all changes into my local repo, all at once-correct? Or perhaps I'm misunderstanding how git pull works?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |