I made some changes to a project and commits them.
I did git pull
to update my local branch before pushing.
The git bash shows:
The following untracked working tree files would be overwritten by merge:
<list of files>
The command git pull -f
had the same effect. I dont what to do git reset --hard origin/<branch_name>
because, to my knowledge that will "delete" my commits.
How do I overwrite all local files that are not committed and keep the commits to then be able to push them?
You could reset them branch to your current HEAD
. That way you'll remove any local changes that aren't committed, but won't lose any commits:
$ git reset HEAD --hard