I just watched some people argue about this, and I didnโt hear anyone describe my favourite solution, so Iโll describe it here. It leaves a perfect trail of breadcrumbs so if I make mistake, I can always rollback. Hopefully, it saves you some time and pain.
In this scenario, Iโve been working in my
feature
branch for two weeks. Of course, lots of changes have been committed to themain
branch while Iโve been working in myfeature
branch. Now itโs time to pull changes frommain
.
> git statusOn branch featurenothing to commit, working tree clean> git checkout main> git pull> git checkout -b feature2> git merge --squash featureAnd then I resume my work in the
feature2
branch.
continue reading on surferjeff.medium.com
โ ๏ธ This post links to an external website. โ ๏ธ
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.