Git commits are duplicated in the same branch after doing a rebase

Short answer You omitted the fact that you ran git push, got the following error, and then proceeded to run git pull: To git@bitbucket.org:username/test1.git ! [rejected] dev -> dev (non-fast-forward) error: failed to push some refs to ‘git@bitbucket.org:username/test1.git’ hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. … Read more

Hg: How to do a rebase like git’s rebase

VonC has the answer you’re looking for, the Rebase Extension. It is, however, worth spending a second or two thinking about why neither mq nor rebase are enabled by default in mercurial: because mercurial is all about indelible changesets. When I work in the manner you’re describing, which is nearly daily, here’s the pattern I … Read more

How do I use `git rebase -i` after `git merge` without messing things up?

Here’s what the rerere-train.sh script I mentioned in my comment does—essentially it redoes the merge, uses your resolution, and just lets rerere see it. You could do this manually just for your single commit if you like: git checkout <parent of merge commit> git merge <merged commit> # if this goes cleanly, we’re done git … Read more

git pull –rebase lost commits after coworker’s git push –force

TL;DR: it’s the fork point code You are getting the effect of git rebase –fork-point, which deliberately drops Dan’s commit from your repository too. See also Git rebase – commit select in fork-point mode (although in my answer there I don’t mention something I will here). If you run the git rebase yourself, you choose … Read more