865
edits
(note about remote tracking branch) |
(update to 1.5.1 workflow, correct some statements) |
||
| Line 14: | Line 14: | ||
Here's how to stay up to date with the remote mozautomation repository: | Here's how to stay up to date with the remote mozautomation repository: | ||
<pre> | <pre> | ||
git pull | git pull --rebase mozauto master // Pulls changes from mozauto to your local machine | ||
git push origin master // Pushes any changes from mozauto to your Github fork | |||
git push origin master | |||
</pre> | </pre> | ||
Now you're in sync. Unless you're working on a maintenance release, skip down to "getting stuff done". | Now you're in sync. Unless you're working on a maintenance release, skip down to "getting stuff done". | ||
= Setting up for Development on 1. | = Setting up for Development on 1.5.1 = | ||
For work on a maintenance release of Mozmill, we'll use the maintenance release branch. Work for the next major version of Mozmill will be done against the "master" branch, which is already set up. Here's how to set up the maintenance branch on your system (Assuming you've already added mozautomation as a remote repository). | For work on a maintenance release of Mozmill, we'll use the maintenance release branch. Work for the next major version of Mozmill will be done against the "master" branch, which is already set up. Here's how to set up the maintenance branch on your system (Assuming you've already added mozautomation as a remote repository). | ||
Pull the 1.5.1 code into a local branch: | |||
<pre>git | <pre> | ||
git | git branch hotfix-1.5.1 mozauto/hotfix-1.5.1 | ||
git checkout hotfix-1.5.1 | |||
</pre> | |||
Now you're on a local branch called "hotfix-1.5.1" with the 1.5.1 code. Use <tt>git checkout</tt> to switch between local branches. | |||
To keep your hotfix-1.5.1 branch updated with the changes to mozauto's 1.5.1 branch: | |||
<pre>git pull --rebase mozauto hotfix-1.5.1</pre> | |||
= Getting Stuff Done = | = Getting Stuff Done = | ||
If you're doing a fix to the maintenance branch then check out that branch (e.g. hotfix-1.5.1). If you're doing a fix to master then checkout master. Create a new, temporary branch off of that branch to do your work in (with the example of master): | |||
<pre> | <pre> | ||
git | git checkout master // we're doing a fix that will land on mozauto master | ||
git pull mozauto master | git pull --rebase mozauto master // make sure local master is up to date | ||
git | git checkout -b myfeature // create new feature branch based on master | ||
git | // make some changes to some files | ||
git commit -a -m "did some stuff" // commit changes to your local myfeature branch | |||
</pre> | </pre> | ||
This is important because it keeps your "master" branch clean. If you use master '''ONLY''' as a area for merging upstream to your fork and mozauto, you'll keep things simple and you will have very few (if any) merge conflicts. So, that's why we recommend doing all feature/bugfix work in a branch. You can optionally push that branch up to your github fork as well (that's recommended, then your code doesn't just live on your own machine). | This is important because it keeps your "master" branch clean. If you use master '''ONLY''' as a area for merging upstream to your fork and mozauto, you'll keep things simple and you will have very few (if any) merge conflicts. So, that's why we recommend doing all feature/bugfix work in a branch. You can optionally push that branch up to your github fork as well (that's recommended, then your code doesn't just live on your own machine). | ||
== Push a Feature branch to | == Push a Feature branch to Github == | ||
<pre> | <pre> | ||
git checkout | git checkout myfeature // switch to feature branch if not already on it | ||
git push origin myfeature // pushes feature branch to your remote (fork on github) | |||
git push origin myfeature // pushes | |||
</pre> | </pre> | ||
| Line 58: | Line 53: | ||
We want to diff your feature branch against the master branch. So ensure your master is up to date and create the diff: | We want to diff your feature branch against the master branch. So ensure your master is up to date and create the diff: | ||
<pre> | <pre> | ||
git checkout myfeature // | git checkout myfeature // switch to myfeature branch if not already on it | ||
git diff -U8 -p master > mypatch.diff // Create the patch | git diff -U8 -p master > mypatch.diff // Create the patch | ||
</pre> | </pre> | ||
| Line 66: | Line 61: | ||
''This only applies if you have commit access to mozautomation'' | ''This only applies if you have commit access to mozautomation'' | ||
Once you have gotten review, it's time to get things ready to land. First, you may have many commits in your patch. We really encourage you to [http://www. | Once you have gotten review, it's time to get things ready to land. First, you may have many commits in your patch. We really encourage you to [http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html] to just the salient commits. You can do that using interactive rebase: | ||
<pre> | <pre> | ||
git checkout myfeature | git checkout myfeature | ||
| Line 72: | Line 67: | ||
</pre> | </pre> | ||
Ok, you've gotten your review, your commits are in good shape, and your commit message is correct, then you're ready to push | Ok, you've gotten your review, your commits are in good shape, and your commit message is correct, then you're ready to push, let's say you want to push to mozauto/master: | ||
<pre> | <pre> | ||
git checkout master // Switch to master branch | git checkout master // Switch to master branch | ||
| Line 82: | Line 77: | ||
</pre> | </pre> | ||
You only need to do pull --rebase if your main master branch is NOT clean. If you have changes on master then this will ensure those changes are applied properly with changes coming downstream from the mozauto master. If the master branch is clean, doing pull --rebase doesn't hurt anything, so it's the recommended step. | You only need to do pull --rebase if your main master branch is NOT clean. If you have changes on master then this will ensure those changes are applied properly with changes coming downstream from the mozauto master. If the master branch is clean, doing pull --rebase doesn't hurt anything, so it's the recommended step. | ||
== Delete a Feature Branch == | == Delete a Feature Branch == | ||
| Line 105: | Line 83: | ||
To delete a local branch, you must switch to the main branch that the local branch was created from. If the branch was created for a feature on the master, then switch to master. If the branch was created for a feature on a maintenance branch, switch to that maintenance branch. Failure to do this will give you a "branch is unmerged warning": | To delete a local branch, you must switch to the main branch that the local branch was created from. If the branch was created for a feature on the master, then switch to master. If the branch was created for a feature on a maintenance branch, switch to that maintenance branch. Failure to do this will give you a "branch is unmerged warning": | ||
<pre> | <pre> | ||
git checkout master // | git checkout master // Move to some other branch | ||
git branch - | git branch -D myfeature // Delete the myfeature branch | ||
</pre> | </pre> | ||
Now, if the branch was pushed to your | Now, if the branch was pushed to your Github repo, we add another step. | ||
<pre> | <pre> | ||
git push origin :myfeature // Removes the branch from github | git push origin :myfeature // Removes the branch from github | ||
</pre> | </pre> | ||
edits