Benefits of branching in Git (for an SVN user)

I have a project using Git. A colleague of mine comes from the SVN world and hesitates checking out a new branch in his local repository. It will work on its local master and select files to push to the remote repository.

How can I convince him of the benefits of branching? For example, what problems might arise when checking out branches?



source to share

2 answers

Question: 58393457 (your question)
Answer: 1 (ie the same answer applies to everyone: better communication).

Set aside time to talk about it. Let him know that you are thrilled that he knows the different systems that are there. Ask him what he thinks, the benefits of git are superior to svn. What about things that he considers to be flaws.

Personally, I've used both last year and heard a lot of "svn works great for me / us", "never asked us any problems", etc. In many cases, the person is unaware of how git works and also does not want to change the tool, which is clear in favor of the industry and the smart people I follow.

Before talking about branching, which is often a big hurdle because the same word really means different things on different systems, I would try to talk about d in dvcs and what is different about it. Tell us about the ability to commit, rollback, etc. To your own repository without a remote server. With svn, everything is in a large "uncommitted" heap until you are online. With git, you can make transactions offline, and when online you can choose when to push those commits. This is tricky because some of the very ways git works are methods that won't work well with svn, so a former svn user might not use them appropriately.

Finally, branches. I would ask the question: "Are we still doing branches the same way (i.e. for the same reasons) as in svn. The answer should be completely inactive. When I collaborate on a project, I usually add and then do a git pull -commit-push to get my work done and sync with others.In fact, knowing git, I also make sure that I do a git pull before starting the session to make sure I'm up to date and have no conflicts.

Branches are very valuable in git. However, I usually keep this kind of activity when I am either doing a version upgrade or I am working on a separate and distinct module for an extended period of time. Usually what will take weeks or months, not hours and days. Usually . Some circumstances may lead to other uses, but the above is the norm for me for projects and organizations that I have worked with and for.

Somewhat an actual answer to your question about "the benefits of branching in git?" " You don't need to use them much the same



There are several advantages to branching with git.

You can create a branch and name it whatever you want without clashing with other human branches. You can name it "temp" or "test" without caring if someone has a branch called temp or test. Branch names are always local until you choose to share them with others.

Branching in git is cheap and fast. The only overhead is the 41-byte file containing the SHA1 hash.

You don't need a server connection to create a branch.

Branching in git is great for making experimental stuff. If you want to fully figure it out and try strange things, create a new branch and rock and roll. If you are not happy with the experiment, just delete the branch.

However, your colleague doesn't seem to understand forking at all, and this is obviously a VCS agnostic question. Why use branches at all? The most obvious reason is to create a seam , i.e. Creating a space where you can work in isolation without worrying about other people's changes. This is both in both directions, you don't want to do with experimental stuff in the main branch.



All Articles