![]() In this case it is important to not push -force otherwise your colleague's work will be erased, and he/she will be pretty upset. However, if you work with people on a same branch and one person pushes the branch with new changes while you make your own changes, then when you will want to push, Git will also tell you that the your local branch and its upstream diverged, and so you should pull first and so on. In this case it is fine to tell git: "Take this version, discard the one you have". So you know that they diverged and that your local version is the correct one. ![]() For example your branch was not up to date with master, so you rebase it to "move it" on top of master (technically, the commits are recreated from the new base, in this case master but effectively it looks as if it has been moved). If you rebased (and therefore created a new chain of commits for your branch), your branch and the remote diverged, which is to be expected. There are two cases, one where it is fine to push force, and one where it is not fine at all: What it does is to replace the remote head of your branch with your local. There is nothing wrong with git push -force on principle. This dosent seem like an solution at all, for me, for such commonly used tool. I've read many threads about this, and the only solution seem to be to use -force I just want to update my feature branch so it's even close to version on master. I have locally: feature branch, master ( up to date )Īnd remote: featureBranch ( which is ahead now ?! ) and master. Hint: See the 'Note about fast-forwards' in 'git push -help' for details. ![]() and end up in same situation? error: failed to push some refs to Updates were rejected because the tip of your current branch is behind Or pull again and deal with the merge conflicts again. I have two options, use -force which seems risky and stupid. Git is really telling me that after doing a rebase ( dealing with n:ths of conflicts ) I know this has been asked before but i cant seem to wrap my head around this thing. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |