我有一个 Git 存储库,其分支几乎不会更改(没有其他人为它做出贡献)。它基本上是去掉了一些代码和文件的主分支。有了这个分支,我可以很容易地打包我的项目的精简版本,而不必每次都手动剥离代码和文件。
我一直在使用git rebase
使该分支与 master 保持最新,但是当我在变基后尝试推送分支时总是收到此警告:
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
然后我使用git push --force
它并且它有效,但我觉得这可能是不好的做法。我想快速轻松地让这个分支与主分支保持“同步”。有没有更好的方法来处理这个任务?
更新
有关完整说明和解决方案,请参阅此主题: