我对git还比较新,过去两个月一直在一个小项目上工作,并且一直没有问题地向bitbucket推送更新。几天前,由于我需要重新安装Linux操作系统,我将项目文件夹压缩了起来。现在,我已经重新安装好了Linux操作系统,解压了这个文件夹。
所以,现在我回到了我的项目文件夹,继续开心地工作,最后执行了以下操作:
git add -A && git commit -m "modified code" && git push origin master
这通常是我的做法。
然后我得到:
To https://johnsproject@bitbucket.org/johnsproject/proj.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://johnsproject@bitbucket.org/johnsproject/proj.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我查看了几个 Stack Overflow 上的问题,他们建议使用一个 force 标志 -f
,但我不确定我是否应该这样做。
p.s:我在主分支上 - 这是我的仓库中唯一的分支。
如果有人能指导我正确方向,我会非常感激。
谢谢。
* 分支 master -> FETCH_HEAD 正在更新 74f5f2e..06e5112 错误:您对以下文件的本地更改将被合并覆盖: 请先提交您的更改或将它们藏起来,再进行合并。
- JohnJgit pull
。 - Bob