On my local feature branch,
- I did some work in a commit, and then manually edited some files to undo some of the work, and committed the undo work into two new commits. Right after making each commit, I also pushed it to GitHub. 
- Then I wanted to clean up my feature branch, by going back to the commit on master where the feature branch was created, by running - git reset HEAD~3- The unstaged changes shown by - git statusat this point was the accumulated changes done in the latest 3 commits, and was exactly what I hoped for after cleaning up. So I ran- git addand- git committo commit them.
- When I tried to push the commit to Github, - $ git push origin feature To https://xxx ! [rejected] feature -> feature (non-fast-forward) error: failed to push some refs to 'https://xxx' 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.- Then I followed the hint by running - git pull, which automatically merged the remote feature branch into my local feature branch, with no merge conflict because their tip commits are identical.- However, the commits removed by - git reset HEAD~3earlier show up again in the output of- git log, and- $ git status On branch feature Your branch is ahead of 'origin/feature' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean- That doesn't clean up my feature branch, but add two new commits to the original feature branch. If I push to github, the remote feature branch will be the same. 
 So do I miss anything? Or generally in similar cases, there is no need to clean up commits?
 
     
     
    