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

Is it good or bad for programmers to encounter such a leader during code review?

Today, when I was browsing the website, I saw a p...

This message is very important! Did you receive it?

It’s the annual season for eating wild mushrooms ...

Here are some practical suggestions on promotion and traffic

On the Internet, most people who work with traffi...

Famous Ships in Chinese History (VIII)

Today I would like to introduce to you the first ...

Beware! Wildfires are more likely to occur in autumn!

Wildfires are more likely to occur in autumn Ente...

How much does it cost to develop an underwear mini program in Panzhihua?

The launch of mini programs has brought convenien...

Learn and use immediately | 4 operational strategies for Father's Day activities

It’s time for the hard-working operators , especi...

He may be the world's first Apple iPhone 6s user

Thanks to the International Date Line, the first ...