Information Technology Reference
In-Depth Information
10-3. Generating (n-1) merge commits
for one commit
Problem
You want to check what the history may look like if the project is realized by n deve-
lopers using Recipe 10-2. To do this you need to simulate the work of three developers:
John, Sarah, and Peter. You have to commit in three different repositories: johns-
repo , sarahs-repo , peters-repo in parallel. Then you will need to synchron-
ize all the repositories. As you will see, the history generated by the $ git pull
commands will contain a large number of superfluous merge commits. In the worst
case scenario one commit can generate up to n-1 merge commits, where n is the num-
ber of developers involved.
Solution
Create a new directory with:
$ cd git-recipes
$ mkdir 10-03
$ cd 10-03
and then initialize a project with:
# the command issued in git-recipes/10-03 directory
$ git init --bare shared-repo
Next, John initializes his repository, creates an initial commit, and pushes it to the
shared-repo:
# commands issued in git-recipes/10-03 directory
$ git clone shared-repo johns-repo
$ cd johns-repo
$ git simple-commit "Initial commit"
$ git push -u origin master
Search WWH ::




Custom Search