Basically I have been working on a feature but when I push the feature back to the main repo for code review they like the entire feature to be pushed as one commit. I normally use git rebase -i for this and set everything except for the first commit to squash and the first to edit. I then paste in the latest files in every time there is a conflict.
I would rather not have to paste various files in during conflicts. I would like to be able to keep the latest files and delete the history of how they came to be in an easier command basically.
EDIT:
I am looking for a Git command equivalent to this bash script:
for file in `git diff --name-only master foo`
git checkout foo $file
Use Squashed Merges
What you want is a squashed merge. This merges all your changes into the working tree, but it’s up to you to make the actual commit. For example:
All your changes from the rebased branch will be made as a single commit, with a single commit message. As long as you resolved any conflicts with your rebase in the foo branch, the merge should generate no conflicts when you merge into master.