Pour enlever des fichiers d'un commit lors d'un rebase interactif : utiliser le keyword 'edit'
Ensuite git reset HEAD^ path/to/file/to/revert
Ensuite git commit --amend
Ensuite git rebase --continue
git rebase -i $(git merge-base HEAD master)
alias grbb='git rebase -i $(git merge-base HEAD master)'
Instead of using -f or --force developers should use
--force-with-lease
Why? Because it checks the remote branch for changes which is absolutely a good idea. Let's imagine that James and Lisa are working on the same feature branch and Lisa has pushed a commit. James now rebases his local branch and is rejected when trying to push. Of course James thinks this is due to rebase and uses --force and would rewrite all Lisa's changes. If James had used --force-with-lease he would have received a warning that there are commits done by someone else. I don't see why anyone would use --force instead of --force-with-lease when pushing after a rebase.
The easiest way would be to find the head commit of the branch as it was immediately before the rebase started in the reflog...
git reflog
and to reset the current branch to it (with the usual caveats about being absolutely sure before reseting with the --hard option).
Suppose the old commit was HEAD@{5} in the ref log:
git reset --hard HEAD@{5}