Git Rebase avoid confusion ⚠️
Don't panic, you might be see the same changes/commit messages two times in your Git history after rebase. Mostly it happened due to the commit already you pushed to remote.
Example:- C1 and C2 commits already pushed to remote branch `dev`, means the C1 and C2 already in your local `dev` branch and remote `dev` branch, at the moment you are doing the rebase from `main` branch to `dev` branch and trying to push the `dev` branch to remote. mostly you will get error like below.
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. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
in this situation mostly people will follow the git suggestion like `git pull origin dev`, this will make duplication of C1 and C2 😂
To avoid the history duplication never rebase commits that have ever existed anywhere but your local repository use merge instead 😎