Sometimes my git history got messed up due to some strange issues. I use the following quick/dirty way to create a clean new branch.
Step 1: use the “git clone” command to clone the master branch to a separate new folder
Step 2: rsync the changed content of your old branch to the new folder excluding the .git subfolder
rsync -avz --exclude .git old-folder/ new-folder
Step 3: create a new branch out of the new folder and then push
$ cd new-folder
$ git checkout -b my-new-branch
Lastly, we can avoid lots of hassles if using “git pull –rebase” instead of the simple “git pull” command.