简体   繁体   中英

How to keep local when I see ERROR: [rejected] master -> master (non-fast-forward)

When using git push , I saw the error:

[rejected]        master -> master (non-fast-forward)

I have double checked and I am 100% sure I want to keep the local master branch's files and folders. And I have also double-checked that the remote bitbucket's master is outdated and not what I want to keep.

So can I just git push --force ? Or is there any other way? I am afraid that git pull will destroy all my local files.

I am the only programmer in this project.

You should be extremely careful about using git push --force if someone else has pulled down changes from the repo. But it sounds like you are the sole user? In that case it seems reasonable to me in your situation.

If you want to get down the remote changes for comparison and possible merge, you can git fetch them. That will not modify your local branches in any way.

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