A few things. First, do not use git branch for scripting, as it is meant to be user-facing command which output format can change and which is subject to config, but git for-each-ref explicitly meant for scripting.
Second, instead of git push --force, use safer alternative of git push --force-with-lease which would overwrite only your changes.
Third, git restore might be easier to use than git reset.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
A few things. First, do not use
git branch
for scripting, as it is meant to be user-facing command which output format can change and which is subject to config, butgit for-each-ref
explicitly meant for scripting.Second, instead of
git push --force
, use safer alternative ofgit push --force-with-lease
which would overwrite only your changes.Third,
git restore
might be easier to use thangit reset
.