简体   繁体   中英

How to push all branches after clearing git file history

I have been following the instructions to remove sensitive information from my github repository using these instructions https://help.github.com/articles/remove-sensitive-data . Everything is working correctly until I try to force push the changes to my repository.

According to the guide, I need to:

git push origin master --force

That worked and my master is updated. The guide now says,

You will need to run this for every branch and tag that was changed. The --all and --tags flags may help make that easier.

I was able to update all tags using:

git push origin master --force --tags

However, I am not able to update all of the remote branches. I have tried to run this command:

git push origin master --force --all

But I get this error:

error: --all can't be combined with refspecs

I have also tried to push to the individual branches with this command:

git push origin dev --force

But I get this error message:

error: src refspec dev does not match any.

error: failed to push some refs to 'git@github.com:

How can I push to all of my remote branches to rewrite their history?

The following should work:

git push -f --all origin

The error "--all can't be combined with refspecs" occurs because you're specifying "--all" alongside the specific branch "master", and you have to pick one or the other. The error "src refspec dev does not match any" occurs because you apparently don't have a refspec called "dev", but you're trying to push it.

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