Skip to content

Working with Figaro Branches

mreposa edited this page Oct 1, 2014 · 1 revision

Overview

Here are steps to follow to get your local machine updated whenever we have a new Figaro release and create a new branch.

One thing to keep in mind is your GitHub account must get the latest changes (such as the new branch) first. Fortunately, it never has changes ahead of p2t2/figaro (unless you have outstanding pull requests, which should be rare).

To start, if you have local changes, make a copy of your current Figaro source tree to ensure you preserve your work.

Run the following at a command prompt on your local machine to verify where your origin is pointing:

git remote –v

This should show:

origin  https://github.com/<your_github_username>/figaro.git (fetch)

origin  https://github.com/<your_github_username>/figaro.git (push)

which indicates your origin points to your GitHub account. If origin points to anything else, don’t proceed until it does.

Update GitHub Account

Update your GitHub account by processing a (reverse) pull request from p2t2/figaro to your GitHub account fork:

  1. Go to your GitHub account page

  2. Open your Figaro fork on GitHub

  3. Click on Pull Requests link on the right hand menu

  4. Click New Pull Request button

    By default, GitHub will compare the original with your fork, but this is going in the wrong direction

  5. Click on switching the base

    Now GitHub will compare your fork with the original, and you should see all the latest changes

  6. Click on Click to create a pull request for this comparison

    Assign a predictable name to your pull request (e.g., Update from original)

  7. Click on Send pull request

  8. Scroll down and click Merge pull request and finally Confirm merge

    Since your fork shouldn’t have any changes, you will be able to merge it automatically

Update Local Machine

Now it becomes a question of merging or not merging on your local machine.

No Local Changes (no merge required)

  1. Open a command prompt and switch to your Figaro work directory on your local machine
  2. Run “git fetch origin” to get the new branch from your GitHub account
  3. Run “git checkout <new_branch_name>” to get on the latest branch

Local Changes (merge required)

  1. Open a command prompt and switch to your Figaro work directory on your local machine
  2. Run “git stash -u” to stash local changes including new, uncommitted files
  3. Run “git fetch origin” to get the new branch from your GitHub account
  4. Run “git merge origin/<new_branch_name>” to bring down the changes in the new branch
  5. Run “git checkout <new_branch_name>” to get on the latest branch
  6. Run “git stash apply” to add back your recently stashed changes
  7. Run “git stash drop” to remove your recently stashed changes from the stack

Afterwards, to keep your local machine up to date, open a command prompt, switch to your Figaro work directory and run:

git pull

Do this often to make sure you have changes made by others working on Figaro.

Here are a couple of links discussing how to resolve merge conflicts, should they arise on your local machine: