this is when the last commit(s) have accidentially been committed to the wrong branch (i.e. master) but HAVE NOT been pushed
git branch newBranch
git reset --hard HEAD~2 # go back 2 commits, you will lose uncommited work
git checkout newBranchNOTE: do the rebase in a separate terminal and resolve conflicts using IntelliJ IDEAS capabilities https://www.atlassian.com/git/tutorials/merging-vs-rebasing/workflow-walkthrough
go to master and update
git co master
git pull origin mastergo to feature branch and rebase (current branch on top of master)
git co <feature-branch>
git rebase -i masterpush
git push -f origin <feature-branch>pick fb554f5 This is commit 1
squash 2bd1903 This is commit 2
squash d987ebf This is commit 3