Information Technology Reference
In-Depth Information
The command $ gitk --all & presents the repository from Figure 6-6 in Figure
6-7 .
Figure 6-7 . The repository from Recipe 6-4 visualized with the gitk application
Keep in mind that it is not possible to do a fast-forward merge in the repository
shown in Figure 6-5 . You can check it using the additional parameter --ff-only of
the $ git merge command. This parameter sets an additional condition on git: per-
form a merge but only if it is a fast-forward case. The command:
$ git merge --ff-only feature
executed in the master branch can be interpreted as the following conditional state-
ment written in pseudo-code:
if (the merge of feature into master is a fast-forward) {
$ git merge feature
}
The command $ git merge --ff-only feature executed in the reposit-
ory shown in Figure 6-5 will fail producing the output:
fatal: Not possible to fast-forward, aborting.
Using the --ff-only switch you can make sure that your merge operation is al-
ways carried out as a fast-forward. If the merging cannot be finished as a fast-forward,
it is aborted. To perform a merge of diverged branches as a fast-forward we will use the
$ git rebase command. This, among others, will be a subject for the next chapter.
 
 
Search WWH ::




Custom Search