Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width70%

Get lasted

Get the latest from upstream

Code Block
git fetch upstream



Create new branch

Now start your branch, the LP-XX refers to the JIRA ticket you pick for your work:

Code Block
git checkout -b LP-XX_branch_name upstream/next



Make changes

Make some changes and 'git add files', double check what you are committing 'git diff --cached'
Before adding files, the files changed can be displayed using 'git status'


Commit

Now commit using 'git commit' command.
Refer to the Jira id in the commit message: "LP_XX ...". This will ensure the commit is picked up by Jira and linked to the original issue.

Probably add some more changes /  commits


Rebase

Once you have finished working on the branch, you are now ready to push it to your fork but there is an extra step you should do to keep things tidy and up to date with the latest LibrePilot so there are no merge conflicts.

Code Block
git fetch upstream
git rebase --interactive upstream/next 
Info

This gives you the chance to also amend/fixup/squash/reword/reorder any commits if you want.
Rebasing can initially by daunting but it is an essential git skill so it is worth learning the ins and outs of it.
Remember if you get into trouble you can always 'git rebase --abort' and ask for help.



Push your code

Now push it to your fork

Code Block
git push -u origin HEAD




Column
width30%


...

Section
Column
width70%

To quickly checkout out someone's work do:

Code Block
git fetch https://bitbucket.org/THEIR_USERNAME/librepilot.git <branch_name> && git checkout FETCH_HEAD

If you are likely to be reviewing this users work a lot you can add their fork as a remote to save using the full URL each time you can add the remote repo:

Code Block
git remote add <dev's_name> https://bitbucket.org/THEIR_USERNAME/librepilot.git

and then each time just do:

Code Block
git fetch <dev's_name> && git checkout <dev's_name>/<branch_name>

Where <dev's_name> is the remote repository name you choose.


Code Block
git remote

give a list of available remote repositories

Column
width30%



...