GIT (DVCS) - Lock or checked out the file (as like svn) and conflict merge the files

旧巷老猫 提交于 2019-12-08 06:01:57

问题


I am just moving from SVN to GIT. I have gone through the posts and comments but not finding effective solution.

I have a below questions:

  1. How to checked out or Lock the files so, other developer is aware that file is unavailable and checked out by this user ?

  2. If one user has updated the same file where other user is working on and both have push the changes to master repository. Now, how it resolve the conflicts or merge.
    How conflict or merge works.
    Do we have a option to manage conflicts in tortoiseGIT or internally manage by GIT repositories push command. ?

Please let me know the above questions resolution.

Thank You.


回答1:


git is a distributed vcs so anything you do will be done to your local repository which itself is unaware of the local repositories of the other developers. So to answer question 1:
Since git doesn't have a central server repository (you can make one but it's only a central repository by your definition not by the design of git) there is no instance that can lock files like in svn.

There is a detailed article here on team workflows.

Merge conflicts are managed by git as far as possible. If it can't resolve it will show that a merge conflict exists for manual resolve.




回答2:


Regarding 2., rebase first your local commits on top of the fetched remote branch (the one the other dev has already push).
The rebase will trigger merges if needed.
You resolve them locally, then push your commits.



来源:https://stackoverflow.com/questions/13045634/git-dvcs-lock-or-checked-out-the-file-as-like-svn-and-conflict-merge-the-f

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!