开发者

Why update before commit?

开发者 https://www.devze.com 2023-03-23 10:39 出处:网络
I have heard this开发者_高级运维 several times, that one should always update before committing to a version control system. Why is that ?If you don\'t update you risk facing a conflict if someone els

I have heard this开发者_高级运维 several times, that one should always update before committing to a version control system. Why is that ?


If you don't update you risk facing a conflict if someone else has edited any of the files you want to commit while you were editing them.

In source control systems like Subversion you won't be allowed to commit before you update even if changes belong to different lines - you will have to first do an update then possibly resolve conflicts, then you'll be allowed to commit. It works like this: you start committing, the Subversion repo server checks whether any of your changes conflict with recent changes, if any of them does conflict the commit is rejected as a whole.

In older systems (I can't name an example) that perhaps could cause serious problems like overwriting changes or doing an incomplete commit (some files committed, some not).


So that you are in sync with the repo and if any conflict happens it happens in your local checkout files, which you can resolve and then commit.


You need to update so that you can get the latest changes before you check in. If you don't take an update, when you come to check in then the VCS will tell you that you need to update.

you can then effectively know your changes are fully integrated with others before you check in

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号