Git process in iOS development

Git process in iOS development

[[152623]]

Git process in iOS development

I believe there is no need for me to elaborate on the advantages of Git, which cannot be compared with SVN and the like.

In the past, when there were multiple people developing, I also used drag files to collaborate with others. - -!

I will not go into details about the basic commands here, but only teach the most practical ones, how to use Git for multi-person development.

Scenario

Three people worked together to develop an app. The eldest was called Xiao Ming, the second was called Xiao Qiang, and the third was called Xiao Wei.

At this time, the boss goes to GitHub to open a repository. Of course, company projects are generally private repos.

After the creation, the boss opened four branches in this repo.

Name is

  1. xiaoming_gittutorial,xiaoqiang_gittutorial,xiaowei_gittutorial,

There is also a develop branch.

This is how it is now.

Ok, now the boss tells the other two to clone the project from GitHub.

Ok, after pulling it down, enter git branch to see what local branches there are.

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

Type git fetch origin develop:develop

This command means pulling a remote branch called develop and creating a local branch called develop to match the remote branch.

After pulling all the files, let's take a look at the local branches.

Now that we have completed the preliminary preparations, how can we ensure that there are as few merge conflicts and pollution of the main branch as possible when multiple people collaborate?

If you do the following, it will be less likely to make big mistakes.

Make good division of labor, especially for storyboards and xibs, and try to avoid multiple people modifying the same file.

Everyone's development work is done in their own branch. For example, if Xiaoming is developing, you can switch to your own xiaoming_gittutorial branch locally and then develop.

Each person is only allowed to push remote branches directly in their own branches.

The following conditions must be followed when merging.

Very important

First, switch to the develop branch locally.

git pull

For example, if you are Xiaoming, then after pulling the latest content from the remote develop, git merge xiaoming_gittutorial.

If there is a conflict, clear the conflict and commit. Then push the local develop to the remote develop.

Submit each feature as it's completed. Don't accumulate code.

What are the benefits of such a process?

There will be almost no conflict.

You will never pollute the develop branch.

Why? Because you always push to the remote after merging locally and clearing conflicts. Then when others update the local develop branch and merge again, even if there is a conflict, it will only be the conflict caused by your latest code.

Finally, let’s sort out our thoughts.

1. During formal development, each person only needs to have two local branches: one called develop and the other one is their own branch.

2. Everyone can push their own branch directly. But when pushing the develop branch, you must first pull the latest remote develop branch, then merge it with the local branch, and clear the conflict before pushing.

Original link: http://www.jianshu.com/p/87e34894a9f9?utm_campaign=maleskine&utm_content=note&utm_medium=writer_share&utm_source=weibo

<<:  Early 2015 year-end summary - the confusion of a newly graduated female programmer

>>:  Twitter may be dying, and it's dying because of a problem we're all facing

Recommend

APP promotion operation: Internet promotion traffic circulation system

Operations are divided into two parts: the first ...

How to efficiently create a set of advertising creative materials?

How to design a good set of materials quickly and...

Reanalyze advertising and marketing!

As the auxiliary optimization functions of advert...

You need to know these when placing CPD in app stores!

Today we will focus on the relevant matters of CP...

Live webcast: Is the regulatory storm coming to an end or just beginning?

Written in front: Are the good days of live strea...

The "Thirty-Six Strategies of Operations" are, after all, a "trap."

Recently, the Internet finance industry and campu...

Frequent early awakening may be a disease. What time is considered "early"?

Have you ever had this experience: you woke up be...