Skip to content

Merging Development Branches into Master

Daniel Peter edited this page Nov 9, 2022 · 5 revisions

Merging Development Branches into Master

Creating a new release candidate branch

  1. To create a remote branch for a new release candidate (RC)
  • you can do it on the website:

-> change branch to devel, write text into “Find or create a branch…”: devel_7.0.0.RC

This will create a new branch devel_7.0.0.RC based on the devel branch

In the following, you will checkout the new remote branch in your existing user fork. There is no need to clone the whole git repository again if you are a maintainer.

  1. Checkout new branch in your fork:
  • update fork:

      $ git fetch upstream
    

    or

      $ git pull upstream
    
  • check with:

      $ git branch -a
    

    new branch remotes/upstream/devel_7.0.0.RC will show up.

  1. create new tracking branch:

       $ git checkout --track upstream/devel_7.0.0.RC
    

    creates local branch, tracking changes in upstream branch

  2. as maintainer, you can push changes to release branch:

       $ git push -u upstream devel_7.0.0.RC
    

    and subsequently just

       $ git push
    

    pushes local branch to upstream, tracking changes in upstream branch

    • check with:

       $ git branch -vv
      
  3. finally, after merging it into master, you can delete it:

    • the local branch:

       $ git branch -d devel_7.0.0.RC
      
    • the remote branch:

       $ git push upstream --delete devel_7.0.0.RC
      

Merging release candidate into master

This explains how to merge a branch devel_7.0.0.RC into the branch master of the repository specfem3d_globe. This is an operation that only the code maintainers can perform.

  1. Build a local clone of the repo

     $ git clone --recursive [email protected]:SPECFEM/specfem3d_globe.git
    

    Note that this will create a different clone than the one you use for your developments. The origin remote will be the main repository as opposed to your own fork on GitHub. To check that do,

         $ git remote -v
     	origin	[email protected]:SPECFEM/specfem3d_globe.git (fetch)
     	origin	[email protected]:SPECFEM/specfem3d_globe.git (push)
    
  2. Now pull the branch you want to merge into master, devel_7.0.0.RC in this example

     $ git branch --track devel_7.0.0.RC origin/devel_7.0.0.RC
    

    You can check that the branch has been created with:

        $ git branch
              devel_7.0.0.RC
            * master
    
  3. Merge the local branch devel_7.0.0.RC into the local branch master

     $ git merge devel_7.0.0.RC
    

    Check that the phrase Fast-forward appears in that merge, as in

         $ git merge devel_7.0.0.RC 
         Updating fd75881..b29a9a7
         Fast-forward
    

    If Fast-forward is not there, something went wrong, most likely your branches are out of sync with the central repo. Fix that before you move to the next step.

  4. Push your master branch to the central repo on GitHub. Remember what Uncle Ben said: "With great power comes great responsibility" ...

     $ git push origin master
    
Clone this wiki locally