The GIT process in iOS development
The virtues of git are not to be mentioned by me, not by SVN.
I used to drag files to work with other people when I was developing them. - -!
I'm not going to say a few basic commands here, just to teach the most practical, how to use git for many people to develop.
Scene
Three people cooperate to develop an app, eldest brother is called Xiaoming, second call small strong, third called Xiao Wei.
At this time eldest brother to GitHub open a repository, of course, the company project is generally private repo.
After the creation of the good. The eldest brother opened four separate branches in this repo.
Name called
Xiaoming_gittutorial,xiaoqiang_gittutorial,xiaowei_gittutorial,
There is also a develop branch.
This is the case now.
OK, now the boss told two other people to clone the project from the GitHub.
OK, after pulling down, enter Git branch to see what the local branch has.
Local only one master, branch. Now, let everyone pull two branches from the remote branch separately. One is develop, one is the branch that represents oneself, for example xiaoming, pull xiaoming_gittutorial.
Enter GIT fetch Origin develop:develop
The meaning of this command is to pull a remote branch called develop and create a local branch called develop that matches the remote branch.
When we're done, let's take a look at the local branches.
We have finished the preparatory work, then how to ensure that many people collaborate to minimize the merge conflict and pollution main branch
Do the following, in fact, it is not easy to appear big flaws.
Do a good job of division of labor, especially storyboard and xib a variety of, try to avoid many people to modify the same file.
All development work for everyone is only developed on its own branch. For example, Xiaoming develops, you switch locally to your Xiaoming_gittutorial branch and then develop.
Each person is allowed to push the remote branch directly in his or her own branch.
The following conditions must be followed when merging.
is very important
First, switch locally to the develop branch.
Git pull
For example, you are xiaoming, then after pull to remote develop the latest content, git merge xiaoming_gittutorial.
If conflict then clears the conflict, commit. Then push the local develop to the remote develop.
Submit once for each function completion. Do not accumulate code.
What is the benefit of such a process?
There will be little conflict.
You will never pollute the develop branch.
Why? Because every time you are in the local merge after the elimination of the conflict and then push the remote, then others update the local develop branch, and then merge, even if the emergence of conflict will only be their latest code generated conflict.
Finally, we'll sort out the idea.
1. At the time of formal development, everyone needs only two branches locally. One is called develop, the other is his own branch.
2. Everyone can push their branches directly. But when the push develop branch. You must first pull the latest remote develop branch. Then merge with the local branch, clear the conflict and push again.