简体   繁体   中英

Is it possible to squish and rename git commits on remote repository without push --force

I need to squish and rename some commits in remote repository history. I can do it on my branch with git rebase -i but trying to push it using git push --force gives me errors. It says remote: error: denying non-fast-forward refs/heads/master . So is there a way around this or do I need to have setting on the remote repository modified to allow this?

The only way to avoid the non-fast forward push is to first delete the remote branch and then push it again.

git push origin :master
git push origin master

Note that you may need to set receive.denyDeleteCurrent to ignore or warn to allow deleting the branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM