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

iPhone battery drain culprit identified! Apple: I admit my mistake

Although the iPhone is not that popular now, and ...

H5 Mobile Debugging Guide

[[406894]] A brief summary: Mobile debugging pain...

From 3GS to 6S, Apple has caused us 9 times more trouble

Apple lets you listen to music, Apple lets you pa...

How to do content operation? It’s all here!

"Content" in a broad sense includes mus...

The darker the egg yolk, the more nutritious it is? The truth is...

"The darker the yolk, the higher the nutriti...

Why does lactose intolerance not affect drinking yogurt?

Calcium is an important nutrient that is indispen...

In Praise of the Independent Programmer

[[149946]] Parkinson’s Theorem[1] tells us that “...

What do astronauts do when they go out for a walk?

The recent "Feel Good" team Going out f...