| 330 | | The main thing to remember is that any branch that is being used in this coordinated fashion should be set up properly using |
| 331 | | - '''git push''' ''remote_name branch_name'' |
| 332 | | and |
| 333 | | - '''git branch --set-upstream''' ''branch_name remote_name/branch_name'' |
| 334 | | where ''remote_name'' is the '''git''' name for the coordinating repository. If the remote repositories are cloned from the coordinating repository, then the standard name ''origin'' may be used. |
| | 340 | In the example below, the '''myrepo''' repository on plato is cloned on host '''huck''' (a host at work). A shared feature branch, '''multi_site''', is created as is a source file '''shared'''. The feature branch is pushed to '''plato''' using '''git flow feature publish'''. Afterwards, the '''plato''' repository is cloned on '''loft''' (a host at home). The feature branch is initialized using '''git flow feature pull'''. Once the feature branch exists on both hosts, the normal '''push''' and '''pull''' command from '''git''' may be used to synchronized the repositories. |
| | 341 | |
| | 342 | {{{#!html |
| | 343 | <pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;"> |
| | 344 | <b style="color:#22c;">conrad@huck ~$ git clone ssh://conrad@plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/myrepo myrepo</b> |
| | 345 | Cloning into 'myrepo'... |
| | 346 | remote: Counting objects: 569, done. |
| | 347 | remote: Compressing objects: 100% (542/542), done. |
| | 348 | remote: Total 569 (delta 175), reused 276 (delta 16) |
| | 349 | Receiving objects: 100% (569/569), 311.17 MiB | 20.57 MiB/s, done. |
| | 350 | Resolving deltas: 100% (175/175), done. |
| | 351 | <b style="color:#22c;">conrad@huck ~/myrepo$ git checkout master</b> |
| | 352 | Branch master set up to track remote branch master from origin. |
| | 353 | Switched to a new branch 'master' |
| | 354 | <b style="color:#22c;">conrad@huck ~/myrepo$ git flow init -d</b> |
| | 355 | Using default branch names. |
| | 356 | |
| | 357 | Which branch should be used for bringing forth production releases? |
| | 358 | - develop |
| | 359 | - master |
| | 360 | Branch name for production releases: [master] |
| | 361 | |
| | 362 | Which branch should be used for integration of the "next release"? |
| | 363 | - develop |
| | 364 | Branch name for "next release" development: [develop] |
| | 365 | |
| | 366 | How to name your supporting branch prefixes? |
| | 367 | Feature branches? [feature/] |
| | 368 | Release branches? [release/] |
| | 369 | Hotfix branches? [hotfix/] |
| | 370 | Support branches? [support/] |
| | 371 | Version tag prefix? [] |
| | 372 | <b style="color:#22c;">conrad@huck ~/myrepo$ git flow feature start multi_site</b> |
| | 373 | Switched to a new branch 'feature/multi_site' |
| | 374 | |
| | 375 | Summary of actions: |
| | 376 | - A new branch 'feature/multi_site' was created, based on 'develop' |
| | 377 | - You are now on branch 'feature/multi_site' |
| | 378 | |
| | 379 | Now, start committing on your feature. When done, use: |
| | 380 | |
| | 381 | git flow feature finish multi_site |
| | 382 | |
| | 383 | <b style="color:#22c;">conrad@huck ~/myrepo$ echo "shared code" > shared</b> |
| | 384 | <b style="color:#22c;">conrad@huck ~/myrepo$ git add shared</b> |
| | 385 | <b style="color:#22c;">conrad@huck ~/myrepo$ git commit -m "shared code" shared</b> |
| | 386 | [feature/multi_site da70383] shared code |
| | 387 | 1 files changed, 1 insertions(+), 0 deletions(-) |
| | 388 | create mode 100644 shared |
| | 389 | <b style="color:#22c;">conrad@huck ~/myrepo$ git flow feature publish multi_site</b> |
| | 390 | Counting objects: 4, done. |
| | 391 | Delta compression using up to 8 threads. |
| | 392 | Compressing objects: 100% (2/2), done. |
| | 393 | Writing objects: 100% (3/3), 283 bytes, done. |
| | 394 | Total 3 (delta 1), reused 1 (delta 0) |
| | 395 | To ssh://conrad@plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/myrepo |
| | 396 | * [new branch] feature/multi_site -> feature/multi_site |
| | 397 | Already on 'feature/multi_site' |
| | 398 | |
| | 399 | Summary of actions: |
| | 400 | - A new remote branch 'feature/multi_site' was created |
| | 401 | - The local branch 'feature/multi_site' was configured to track the remote branch |
| | 402 | - You are now on branch 'feature/multi_site' |
| | 403 | |
| | 404 | <i><b style="color:#2a2;">Subsequently, on another host...</b></i> |
| | 405 | |
| | 406 | <b style="color:#2a2;">[loft - ~]$ git clone ssh://conrad@plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/myrepo myrepo</b> |
| | 407 | Cloning into 'myrepo'... |
| | 408 | remote: Counting objects: 569, done. |
| | 409 | remote: Compressing objects: 100% (542/542), done. |
| | 410 | Receiving objectsremote: Total 569 (delta 175), reused 276 (delta 16) |
| | 411 | Receiving objects: 100% (569/569), 311.17 MiB | 586 KiB/s, done. |
| | 412 | Resolving deltas: 100% (175/175), done. |
| | 413 | <b style="color:#2a2;">[loft - ~]$ cd myrepo/</b> |
| | 414 | /e/home/conrad/myrepo |
| | 415 | <b style="color:#2a2;">[loft - ~/myrepo]$ git checkout master</b> |
| | 416 | Branch master set up to track remote branch master from origin. |
| | 417 | Switched to a new branch 'master' |
| | 418 | <b style="color:#2a2;">[loft - ~/myrepo]$ git flow init -d</b> |
| | 419 | Using default branch names. |
| | 420 | |
| | 421 | Which branch should be used for bringing forth production releases? |
| | 422 | - develop |
| | 423 | - master |
| | 424 | Branch name for production releases: [master] |
| | 425 | |
| | 426 | Which branch should be used for integration of the "next release"? |
| | 427 | - develop |
| | 428 | Branch name for "next release" development: [develop] |
| | 429 | |
| | 430 | How to name your supporting branch prefixes? |
| | 431 | Feature branches? [feature/] |
| | 432 | Release branches? [release/] |
| | 433 | Hotfix branches? [hotfix/] |
| | 434 | Support branches? [support/] |
| | 435 | Version tag prefix? [] |
| | 436 | <b style="color:#2a2;">[loft - ~/myrepo]$ git flow feature pull origin multi_site</b> |
| | 437 | Created local branch feature/multi_site based on origin's feature/multi_site. |
| | 438 | <b style="color:#2a2;">[loft - ~/myrepo]$ cat shared</b> |
| | 439 | shared code |
| | 440 | <b style="color:#2a2;">[loft - ~/myrepo]$ echo "more shared code" >> shared</b> |
| | 441 | <b style="color:#2a2;">[loft - ~/myrepo]$ git commit -a -m "more code added"</b> |
| | 442 | <b style="color:#2a2;">[feature/multi_site f9d8a3d] more code added |
| | 443 | 1 files changed, 1 insertions(+), 0 deletions(-) |
| | 444 | [loft - ~/myrepo]$ git push</b> |
| | 445 | Counting objects: 5, done. |
| | 446 | Delta compression using up to 4 threads. |
| | 447 | Compressing objects: 100% (2/2), done. |
| | 448 | Writing objects: 100% (3/3), 279 bytes, done. |
| | 449 | Total 3 (delta 1), reused 0 (delta 0) |
| | 450 | To ssh://conrad@plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/myrepo |
| | 451 | da70383..f9d8a3d feature/multi_site -> feature/multi_site |
| | 452 | |
| | 453 | <i><b style="color:#22c;">Back to the first host...</b></i> |
| | 454 | |
| | 455 | <b style="color:#22c;">conrad@huck ~/myrepo$ git pull</b> |
| | 456 | remote: Counting objects: 5, done. |
| | 457 | remote: Compressing objects: 100% (2/2), done. |
| | 458 | remote: Total 3 (delta 1), reused 0 (delta 0) |
| | 459 | Unpacking objects: 100% (3/3), done. |
| | 460 | From ssh://plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/myrepo |
| | 461 | da70383..f9d8a3d feature/multi_site -> origin/feature/multi_site |
| | 462 | Updating da70383..f9d8a3d |
| | 463 | Fast-forward |
| | 464 | shared | 1 + |
| | 465 | 1 files changed, 1 insertions(+), 0 deletions(-) |
| | 466 | |
| | 467 | <b style="color:#22c;">conrad@huck ~/myrepo$ cat shared</b> |
| | 468 | shared code |
| | 469 | more shared code |
| | 470 | |
| | 471 | </pre> |
| | 472 | }}} |