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

Air turns into fuel? This technology may hold the code to energy

Produced by: Science Popularization China Produce...

Analysis of the refined operation routines of VVIP users on video websites

When it comes to the VIP dispute, people initiall...

Tips for creating landing pages for advertising!

This article will share with you the techniques f...

Shaxian is the empire of snacks, and Danxia is a world heritage site

Loading long image... Source: Authentic Scenery...

Your level of social anxiety may be related to this gene | Expo Daily

Your level of social anxiety may be related to th...

WeChat Moments Advertising- Charging Strategy

Moments ads support two purchasing methods: sched...

On World Pangolin Day, can we wait for good news about pangolins?

Today - the third Saturday in February - is World...

Decline or turnaround, how can the points wall occupy the high ground?

The game of mobile marketing does have many cleve...

How many steps does it take for humans to explore Mars? | Zhao Yuyu

There is no fire on Mars, so why is it called &qu...

Turn your marketing campaign into a profitable business

Any large-scale marketing campaign will inevitabl...