##// END OF EJS Templates
docs: added 4.0.1 release notes
docs: added 4.0.1 release notes

File last commit:

r1:854a839a default
r15:9b3c78f4 default
Show More
forks-branches.rst
101 lines | 2.9 KiB | text/x-rst | RstLexer

Forking and Branching

Forking clones the original |repo| and creates an independent |repo|. Branching allows you to develop independently of the main branch based on the changeset branched, but remains linked to the main |repo|.

Both provide excellent collaboration functionality, and do not differ greatly, but you can find many online discussions where people fight about the differences.

Fork a |repo|

To fork a |repo|, use the following steps:

  1. Select :menuselection:`Admin --> repositories`
  2. Select the |repo| you wish to fork.
  3. Select :menuselection:`Options --> Fork`
  4. On the :guilabel:`Create fork` page, set the following properties:
    • The fork name
    • The fork description
    • If the fork is private or public
    • The copy permissions

Branch a |git| |repo|

Currently branching is only supported from the command line but is picked up on the web interface. To branch a |git| |repo| use the following example:

# branch and checkout
git branch new-branch
git checkout new-branch

# same function shorthand
git checkout -b new-branch

# Example usage
$ git checkout -b example-branch
Switched to a new branch 'example-branch'

$ git status
On branch example-branch
Initial commit
nothing to commit (create/copy files and use "git add" to track)
$ vi example-script.sh
$ git add example-script.sh
$ git commit -a -m "ghost script: initial file"
$ git push

Once it is pushed to the |RCM| server, you can switch to the newly created branch using the following steps:

  1. Select :menuselection:`Admin --> Repositories`.
  2. Select the |repo| you branched.
  3. Select :menuselection:`Switch To --> Branches` and choose the new branch.

For more information, your can read more here on the Git website, Git Branching.

Branch a |hg| |repo|

Note

To use branches in |hg| like |git|, use the hg bookmark option instead. Also see the :ref:`bvb` section for more information.

To branch a |hg| |repo|, use the following example and push your changes to the main |repo|. Once pushed, you can view the new branch in |RCE| by selecting :menuselection:`Switch To --> Branches` from the |repo| page.

$ hg branch example-456
$ hg ci -m "branch: ticket #456"
$ hg push --new-branch

Bookmark a |hg| |repo|

Bookmarks are used in |hg| in much the same way as branches are in |git|. See the Mercurial Bookmarks documentation for more information.

$ hg bookmark example-456
$ hg ci -m "branch: ticket #456"
$ hg push -B example-456
../images/branch-example.png