IOS development: Git Process

Source: Internet
Author: User
Tags how to use git

IOS development: Git Process

 

  Git process in iOS development

I believe that the advantages of Git are no longer mentioned in detail. It is not the same as that of SVN.

I used to drag files for development by many people before and cooperate with others. --!

I will not talk about some basic commands here. I will only teach you how to use Git for most practical development.

 Scenario

The three developers work together to develop an app. The boss is Xiao Ming, the second is Xiao Qiang, and the third is Xiao Wei.

At this time, the boss went to github to open a repository. Of course, company projects are generally private repo.

After creation. The boss has four branches in this repo.

The name is

Xiaoming_gittutorial, xiaoqiang_gittutorial, xiaowei_gittutorial,

There is also a develop branch.

This is the case now.

Okay. Now the boss tells the other two people to clone the project from github.

OK. After pulling it down, enter git branch to see which local branches are available.

There is only one master and branch locally. Now, let each person pull two branches from the remote branch. One is develop, and the other is the branch that represents itself. For example, Xiaoming pulls xiaoming_gittutorial.

Enter git fetch origin develop: develop

This command pulls a remote branch called develop and creates a local branch named develop to match the remote branch.

After pulling all the data, let's look at the local branches.

We have completed the preparatory work, and how can we ensure that merge conflict and contaminated Main Branches are as few as possible during multi-person collaboration?

In fact, it is not easy to have a big flaw when doing the following.

Do a Good Job of division of labor, especially storyboard and xib. Try to avoid the occurrence of multiple users modifying the same file.

Everyone's development work is only developed in their own branch. For example, you can switch to your own xiaoming_gittutorial branch locally for development.

Each person can only push the remote branch directly in his/her own branch.

The following conditions must be observed during merge.

Very important

First, switch to the develop branch locally.

Git pull

For example, if you are James, git merge xiaoming_gittutorial after pull reaches the latest develop content remotely.

If conflict appears, after the conflict is cleared, commit. Then push the local develop to the remote develop.

Submit each time you complete a function. Do not accumulate code.

What are the benefits of such a process?

Almost no conflict appears.

You will never pollute the develop branch.

Why? Because every time you clear the conflict in the local merge, the push will be remote, so when someone else updates the local develop branch and then merges it, even if conflict appears, it will only be the conflict generated by the latest code.

Finally, let's clarify our ideas.

1. During official development, each person only needs two local branches. One is develop and the other is its own branch.

2. Each person can directly push their own branch. But when pushing the develop branch. You must first use the latest remote develop branch of pull. Merge with the local branch, clear the conflict, and then push.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.