Difference between revisions of "Newbie Guide for Windows People Working on Minor Bugs"

From Dreamwidth Notes
Jump to: navigation, search
m
(mention in section title where things take place + various edits)
Line 14: Line 14:
 
# You need a text editor to edit your files.
 
# You need a text editor to edit your files.
 
# You need a Bugzilla account to find and files bugs.
 
# You need a Bugzilla account to find and files bugs.
 +
 +
Each section title or content mentions where you need to do things so you don't get lost.
  
 
== Create an account on GitHub ==
 
== Create an account on GitHub ==
Line 40: Line 42:
 
<syntaxhighlight lang="bash">passwd</syntaxhighlight>
 
<syntaxhighlight lang="bash">passwd</syntaxhighlight>
  
* Your default Dreamhack account is called system. Type this to set its password:
+
* Your default Dreamhack account is called 'system'. Set its password wit this command:
  
 
<syntaxhighlight lang="bash">$LJHOME/bin/upgrading/make_system.pl</syntaxhighlight>
 
<syntaxhighlight lang="bash">$LJHOME/bin/upgrading/make_system.pl</syntaxhighlight>
Line 47: Line 49:
 
== Install WinSCP ==
 
== Install WinSCP ==
  
* Install [http://winscp.net/eng/download.php WinSCP]. During the installation, you may be asked about the mode you prefer: Commander and Explorer. Commander works like an FTP client: a partitioned window with your computer files on one side and the Dreamhack files on the other. Explorer will only display your Dreamhack files and works like Windows's Explorer. I prefer this mode because I rarely need to access my computer files but choose what's easiest for you.
+
* Install [http://winscp.net/eng/download.php WinSCP]. During the installation, you may be asked about the mode you prefer: Commander and Explorer. Commander works like an FTP client: a partitioned window with your computer files on one side and the Dreamhack files on the other. Explorer will only display your Dreamhack files and works like Windows's Explorer. The Explorer mode is perfectly fitted for working on things but if you're used to commander-like windows you might prefer it.
  
 
* Use "hack.dreamwidth.net" for the host name. Enter your username and the password you typed when you did <code>passwd</code> on PuTTY. Click on Save then on Login.
 
* Use "hack.dreamwidth.net" for the host name. Enter your username and the password you typed when you did <code>passwd</code> on PuTTY. Click on Save then on Login.
Line 61: Line 63:
 
Simply [http://bugs.dwscoalition.org/createaccount.cgi click here].
 
Simply [http://bugs.dwscoalition.org/createaccount.cgi click here].
  
: N.B. As <dwuser>mark</dwuser> explained [http://dw-dev.dreamwidth.org/17146.html here], go to [http://bugs.dwscoalition.org/userprefs.cgi?tab=account Name and Password] and enter your name following this format: <code>Name [:username]</code>. 'Name' can be your real name, a nickname, your username again, etc. You don't have to give your real name if you don't want to.
+
: N.B. As <dwuser>mark</dwuser> explained [http://dw-dev.dreamwidth.org/17146.html here], go to [http://bugs.dwscoalition.org/userprefs.cgi?tab=account Name and Password] and enter your name following this format: <code>Name [:username]</code>. 'Name' can be your real name, a nickname, your username again, etc. Pick what you're comfortable with.
  
  
Line 68: Line 70:
 
== On your GitHub account ==
 
== On your GitHub account ==
  
You need to fork the Dreamwidth code onto your own account. Forking is like cloning and branching. It will copy the code and also label your copy as being a branch (a fork) of the original Dreamwidth code so that we know the two are connected.
+
You need to fork the Dreamwidth code onto your own account. Forking is like cloning and branching. It will copy the code and also label your copy as being a branch (a fork) of the original Dreamwidth code so that everybody knows the two are connected.
  
Dreamwidth is divided into two parts: a open-source part called 'dw-free', and a private part called 'dw-nonfree'. The private part is composed of elements which are specific to dreamwidth.org and can't be used on other sites (the logo for example) and external elements Dreamwidth is allowed to use on its own site but not redistribute to other sites.  
+
Dreamwidth is divided into two parts: a open-source part called 'dw-free', and a private part called 'dw-nonfree'. The private part is composed of elements which are specific to dreamwidth.org and can't be used on other sites (e.g. the logo) and external elements Dreamwidth is allowed to use on its own site but not redistribute to other sites.  
  
 
* To fork the free part go to https://github.com/dreamwidth/dw-free and click on Fork on the upper right corner.
 
* To fork the free part go to https://github.com/dreamwidth/dw-free and click on Fork on the upper right corner.
Line 81: Line 83:
 
Now you need to 'import' both of these onto your Dreamhack and link them to the original Dreamwidth repositories on GitHub so you can easily fetch updates.
 
Now you need to 'import' both of these onto your Dreamhack and link them to the original Dreamwidth repositories on GitHub so you can easily fetch updates.
  
To do so, [[Moving_your_Dreamwidth_installation_to_use_Github#Stop_the_server_and_all_workers | follow all the steps from this point on until you start your server again]] (but skip the 'non-dreamhack users' section, of course).
+
To do so, [[Moving_your_Dreamwidth_installation_to_use_Github#Stop_the_server_and_all_workers | follow all the steps from this point on until you start your server again]] (but skip the 'non-dreamhack users' section).
  
  
Line 90: Line 92:
 
=== Change some git settings ===
 
=== Change some git settings ===
  
On PuTTY, I suggest going through [[Git_settings#Recommended_settings|all the steps mentioned in this section]].
+
In PuTTY, I suggest going through [[Git_settings#Recommended_settings|all the steps mentioned in this section]].
  
  
 
=== Give special abilities to your system account ===
 
=== Give special abilities to your system account ===
  
* Log in to your Dreamhack (http://www.USERNAME.hack.dreamwidth.net/) using system and your password.
+
* Log in to your Dreamhack (http://www.USERNAME.hack.dreamwidth.net/) using system and your password for this account.
  
 
* Go to [http://www.USERNAME.hack.dreamwidth.net/admin/priv/ http://www.USERNAME.hack.dreamwidth.net/admin/priv/]. Click on 'payments' type 'system' in the User field then click on 'Make Changes'. The system account now has the ability (called 'privilege' or 'priv') to give paid time to any account.
 
* Go to [http://www.USERNAME.hack.dreamwidth.net/admin/priv/ http://www.USERNAME.hack.dreamwidth.net/admin/priv/]. Click on 'payments' type 'system' in the User field then click on 'Make Changes'. The system account now has the ability (called 'privilege' or 'priv') to give paid time to any account.
Line 120: Line 122:
 
= Make sure things are up-to-date =
 
= Make sure things are up-to-date =
  
Important: you can generally get explanations about any bash command using <code>help COMMAND</code> (e.g. <code>help cd</code>) and any git command using <code>git COMMAND -h</code> (e.g <code>git pull -h</code>).
+
Important: in PuTTY, you can get explanations about bash commands using <code>help COMMAND</code> (e.g. <code>help cd</code>) and any git commands using <code>git COMMAND -h</code> (e.g <code>git pull -h</code>).
  
  
== Update your code ==
+
== Update your code (in PuTTY) ==
  
 
Code is committed by developers all the time. You must always update your repositories before you do anything else.
 
Code is committed by developers all the time. You must always update your repositories before you do anything else.
Line 138: Line 140:
 
git push origin master</syntaxhighlight>
 
git push origin master</syntaxhighlight>
  
: N.B. When you do this you be will asked for your password on GitHub. Again, the cursor won't move as you type it. This is normal.
+
: N.B. When you do this you be will asked for your password on GitHub. Again, the cursor won't move as you type it.
  
 
* For the nonfree part of the code, the commands are exactly the same except the first one, as nonfree is in a different folder:
 
* For the nonfree part of the code, the commands are exactly the same except the first one, as nonfree is in a different folder:
Line 146: Line 148:
 
* You can also create a script to make this process simpler: see [[Dev_Maintenance#dwu_-_Updating_the_repos | this article]].
 
* You can also create a script to make this process simpler: see [[Dev_Maintenance#dwu_-_Updating_the_repos | this article]].
  
: N.B. To create a new file on WinSCP, right click into the correct folder (<code>/bin</code> here) then click on New/File.
+
: N.B. To create a new file open WinSCP, right click into the correct folder (<code>/bin</code> here) then click on New/File.
  
  
== Update your database ==
+
== Update your database (in PuTTY) ==
  
 
* We're already seen this once but here it is again:
 
* We're already seen this once but here it is again:
Line 162: Line 164:
 
= Make changes to your local code =
 
= Make changes to your local code =
  
== Find or file a bug ==
+
== Find or file a bug (in Bugzilla) ==
  
 
* To find: you can use [http://bugs.dwscoalition.org/userprefs.cgi?tab=saved-searches predefined searches] such as [http://bugs.dwscoalition.org/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=unassigned%20effort-minor&sharer_id=2 unassigned effort-minor].
 
* To find: you can use [http://bugs.dwscoalition.org/userprefs.cgi?tab=saved-searches predefined searches] such as [http://bugs.dwscoalition.org/buglist.cgi?cmdtype=dorem&remaction=run&namedcmd=unassigned%20effort-minor&sharer_id=2 unassigned effort-minor].
Line 175: Line 177:
  
  
== Create a local branch stemming from develop ==
+
== Create a local branch stemming from develop (in PuTTY) ==
  
* In PuTTY, pick the correct repository:
+
* Pick the correct repository:
 
** if you want to work in dw-free you need to be in <code>~/dw$</code>. If you're not type <code>cd $LJHOME</code>.
 
** if you want to work in dw-free you need to be in <code>~/dw$</code>. If you're not type <code>cd $LJHOME</code>.
 
** if you want to work in dw-nonfree you need to be in <code>~/dw/ext/dw-nonfree$</code>. If you're not type <code>cd $LJHOME/ext/dw-nonfree</code>
 
** if you want to work in dw-nonfree you need to be in <code>~/dw/ext/dw-nonfree$</code>. If you're not type <code>cd $LJHOME/ext/dw-nonfree</code>
Line 206: Line 208:
  
  
== Work, work, work ==
+
== Work, work, work (in WinSCP and your editor) ==
  
* Use WinSCP to open the file you need to edit, add new files or delete existing ones.
+
* In WinSCP right click to edit the file you want to work on.
  
 
* Remember that the free part of the code is in <code>~/dw/*</code> while the non-free part is in <code>~/dw/ext/dw-nonfree/*</code>.
 
* Remember that the free part of the code is in <code>~/dw/*</code> while the non-free part is in <code>~/dw/ext/dw-nonfree/*</code>.
Line 216: Line 218:
 
* For text strings which are not in <code>~dw/htdocs/xxx.bml.text</code> files, see <code>~dw/bin/upgrading/en.dat</code>.
 
* For text strings which are not in <code>~dw/htdocs/xxx.bml.text</code> files, see <code>~dw/bin/upgrading/en.dat</code>.
  
* For more specific searches, you can use the grep command: <code>grep [option(s)] pattern [file(s)]</code>
+
* For more specific searches, you can use the grep command in PuTTY: <code>grep [option(s)] pattern [file(s)]</code>
  
 
Interesting options:
 
Interesting options:
Line 247: Line 249:
  
  
== Test your changes on your Dreamhack ==
+
== Test your changes on your Dreamhack (in PuTTY and your Dreamhack) ==
  
 
* In PuTTY, stop your Dreamhack:
 
* In PuTTY, stop your Dreamhack:
Line 264: Line 266:
  
  
== Mark your local changes as ready to be committed ==
+
== Mark your local changes as ready to be committed (in PuTTY) ==
  
 
Before being committed, work is moved to a staging area. Think of it as the "Ready? Steady?" before the "Go!". At this point nothing is definite and you can easily change things.
 
Before being committed, work is moved to a staging area. Think of it as the "Ready? Steady?" before the "Go!". At this point nothing is definite and you can easily change things.
  
* In PuTTY, you can add your changes to the staging ('pre-commit') area using the <code>add</code> command:
+
* You can add your changes to the staging ('pre-commit') area using the <code>add</code> command:
  
 
<syntaxhighlight lang="bash">git add FILENAME</syntaxhighlight>
 
<syntaxhighlight lang="bash">git add FILENAME</syntaxhighlight>
Line 283: Line 285:
  
  
== Commit your changes locally ==
+
== Commit your changes locally (in PuTTY) ==
  
 
* If you think you're done with your work at this point you can commit your changes locally using the <code>commit</code> command:
 
* If you think you're done with your work at this point you can commit your changes locally using the <code>commit</code> command:
Line 312: Line 314:
  
  
= Go from local to the World Wide Web =
+
= Go from local to the World Wide Web (in PuTTY) =
  
 
== Push the changes to your github.com repository ==
 
== Push the changes to your github.com repository ==
Line 323: Line 325:
  
  
== Request your changes to be pulled into the main code ==
+
== Request your changes to be pulled into the main code (on github.com) ==
  
 
On your GitHub page, click on the correct repository (dw-free or dw-nonfree), select the correct branch in the branch drop-down menu (below 'Clone in Windows') then click on Pull Request below.
 
On your GitHub page, click on the correct repository (dw-free or dw-nonfree), select the correct branch in the branch drop-down menu (below 'Clone in Windows') then click on Pull Request below.
Line 330: Line 332:
  
  
== Mention the pull request on Bugzilla ==
+
== Mention the pull request (on Bugzilla) ==
  
 
* Comment on the bug with a link to your pull request.
 
* Comment on the bug with a link to your pull request.
Line 342: Line 344:
  
  
= More: checking things =
+
= More: checking things (in PuTTY) =
  
 
* To check which local branch you're on (noted with an asterisk):
 
* To check which local branch you're on (noted with an asterisk):
Line 375: Line 377:
  
  
= More: stashing your changes =
+
= More: stashing your changes (in PuTTY) =
  
 
If you have work you haven't committed yet and you want to work on another bug or update your 'master' and 'develop' branches you need to stash your work first. It's generally good practice to do this every time you have work you haven't committed.
 
If you have work you haven't committed yet and you want to work on another bug or update your 'master' and 'develop' branches you need to stash your work first. It's generally good practice to do this every time you have work you haven't committed.
Line 394: Line 396:
  
  
= More: Undoing changes =
+
= More: Undoing changes (in PuTTY) =
  
 
* If you added a file using <code>git add</code> but finally want to unstage it (i.e. remove it from the staging area before you do <code>git commit</code>), you can use the <code>reset</code> command:
 
* If you added a file using <code>git add</code> but finally want to unstage it (i.e. remove it from the staging area before you do <code>git commit</code>), you can use the <code>reset</code> command:
Line 411: Line 413:
  
  
= More: moving files =
+
= More: moving files (in PuTTY) =
  
 
Use the <code>mv</code> command:
 
Use the <code>mv</code> command:
Line 418: Line 420:
  
  
= More: deleting files =
+
= More: deleting files (in PuTTY) =
  
 
Use the <code>rm</code> command:
 
Use the <code>rm</code> command:
Line 425: Line 427:
  
  
= More: deleting branches =
+
= More: deleting branches (in PuTTY) =
  
 
* Once your work on a bug is done and your branch has been merged into develop you can delete your local branch:
 
* Once your work on a bug is done and your branch has been merged into develop you can delete your local branch:
Line 442: Line 444:
  
  
= More: renaming branches =
+
= More: renaming branches (in PuTTY) =
  
 
If you've made a mistake and want to rename a local branch, you can use:
 
If you've made a mistake and want to rename a local branch, you can use:

Revision as of 19:58, 19 September 2012

Note: Feel free to correct, expand, do anything which could make this better and clearer. ^_^


What do you need and why?

Because you're on Windows, you have to use quite a number of tools to access and manage things so this part might seem a little daunting. The good news is that 1) you're used to being flexible and resourceful, right? 2) once you've got everything set up things will be much simpler and intuitive.

So what do you need?

  1. You need a Github account to be able to fetch the Dreamwith code, create your own copies of it, and upload your own changes. This is both where all the Dreamwidth code comes from and where your own code will end on but it's only a gateway: you can't do much on github.com itself.
  2. You need a Dreamhack to see what your changes will do on the site for real. Think of a Dreamhack as an online mirror of the Dreamwidth site which you get to play with and modify.
  3. You need PuTTY to connect GitHub to your Dreamhack, to connect your Dreamhack to GitHub, and access and manage everything. In short, PuTTY is your true command center.
  4. You need WinSCP to visualize your Dreamhack files and be able to open them in a text editor. It's pretty much like Explorer for your Dreamhack.
  5. You need a text editor to edit your files.
  6. You need a Bugzilla account to find and files bugs.

Each section title or content mentions where you need to do things so you don't get lost.

Create an account on GitHub

Go to GitHub, click on 'sign up and pricing' and create a free account. I suggest you pick a username people are familiar with and the same username you'll have on your Bugzilla account.


Get a Dreamhack

Apply for a Dreamhack by filling this form. The two important fields are 'your desired username' and 'your email address'. Your username is used to manage your Dreamhack and to create the URL where your Dreamhack will be located at so you can pick anything. Your email address is used to send you a welcome e-mail which contains important information as well as various alerts. You can pick any of your existing email addresses or choose to create an email account entirely devoted to your development work.

Once you're done, you should get an e-mail with your login username and a password. Don't lose it.


Install PuTTY

  • Download 'Windows installer for everything except PuTTYtel' .exe file at PuTTY and install it.
  • Run PuTTY. In the configuration window, enter "hack.dreamwidth.net" for the host name. Go to Connection/Data and enter the username/login given to you in the welcome e-mail. It should be something like dh-username.
  • Click on Open. If you get a pop-up message about a key, click Yes.
  • Enter the password given to you in the welcome e-mail when asked. Note that no characters are displayed and the cursor won't move. It's normal.
  • Change your password by typing:
passwd
  • Your default Dreamhack account is called 'system'. Set its password wit this command:
$LJHOME/bin/upgrading/make_system.pl


Install WinSCP

  • Install WinSCP. During the installation, you may be asked about the mode you prefer: Commander and Explorer. Commander works like an FTP client: a partitioned window with your computer files on one side and the Dreamhack files on the other. Explorer will only display your Dreamhack files and works like Windows's Explorer. The Explorer mode is perfectly fitted for working on things but if you're used to commander-like windows you might prefer it.
  • Use "hack.dreamwidth.net" for the host name. Enter your username and the password you typed when you did passwd on PuTTY. Click on Save then on Login.


Get a good text editor

While you can use Notepad, I recommend Notepad++ instead. It's free, simple and will make editing much easier.


Create a Bugzilla account

Simply click here.

N.B. As [info]mark explained here, go to Name and Password and enter your name following this format: Name [:username]. 'Name' can be your real name, a nickname, your username again, etc. Pick what you're comfortable with.


Set things up

On your GitHub account

You need to fork the Dreamwidth code onto your own account. Forking is like cloning and branching. It will copy the code and also label your copy as being a branch (a fork) of the original Dreamwidth code so that everybody knows the two are connected.

Dreamwidth is divided into two parts: a open-source part called 'dw-free', and a private part called 'dw-nonfree'. The private part is composed of elements which are specific to dreamwidth.org and can't be used on other sites (e.g. the logo) and external elements Dreamwidth is allowed to use on its own site but not redistribute to other sites.


On your Dreamhack

Now you need to 'import' both of these onto your Dreamhack and link them to the original Dreamwidth repositories on GitHub so you can easily fetch updates.

To do so, follow all the steps from this point on until you start your server again (but skip the 'non-dreamhack users' section).


Further configuration steps

These are not mandatory but will make your life easier.

Change some git settings

In PuTTY, I suggest going through all the steps mentioned in this section.


Give special abilities to your system account


Get rid of invite codes

  • In WinSCP, go to /dw/ext/local/etc/, and double-click on config.pl. Find $USE_ACCT_CODES = 1; and change 1 to 0. Save your file.
  • In PuTTY, type this to make the changes go live on your Dreamhack:
$LJHOME/bin/upgrading/update-db.pl -r -p --innodb
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb
$LJHOME/bin/upgrading/texttool.pl load


Customize PuTTY and Notepad++

See these articles for details: PuTTY, Notepad++.


Make sure things are up-to-date

Important: in PuTTY, you can get explanations about bash commands using help COMMAND (e.g. help cd) and any git commands using git COMMAND -h (e.g git pull -h).


Update your code (in PuTTY)

Code is committed by developers all the time. You must always update your repositories before you do anything else.

  • Use the pull command to fetch updates to each of the base branch:
cd $LJHOME
git pull dreamwidth develop:develop
git pull dreamwidth master:master
  • Then use the push command to forward the changes on your GitHub fork:
git push origin develop
git push origin master
N.B. When you do this you be will asked for your password on GitHub. Again, the cursor won't move as you type it.
  • For the nonfree part of the code, the commands are exactly the same except the first one, as nonfree is in a different folder:
cd $LJHOME/ext/dw-nonfree
  • You can also create a script to make this process simpler: see this article.
N.B. To create a new file open WinSCP, right click into the correct folder (/bin here) then click on New/File.


Update your database (in PuTTY)

  • We're already seen this once but here it is again:
$LJHOME/bin/upgrading/update-db.pl -r -p --innodb
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb
$LJHOME/bin/upgrading/texttool.pl load
  • You can also create a script to make this process simpler: see this article.


Make changes to your local code

Find or file a bug (in Bugzilla)

Some of these bugs won't appear to require 'minor' effort to you. It's normal. Try to find small bugs among them: minor modifications to be done on one of the site pages (text to be modified; elements to be added, removed or moved; elements to be hidden from some categories of users, etc.).
  • To assign a bug to yourself, enter your Bugzilla e-mail address in Assign To and set the status to IN_PROGRESS.
To make this easier, you can also use one of [info]fu's Greasemonkey scripts: Dreamwidth Bug Grabber. Click on (grab!) next to Assign To and this will edit it and Status for you. Click on Save Changes of course.


Create a local branch stemming from develop (in PuTTY)

  • Pick the correct repository:
    • if you want to work in dw-free you need to be in ~/dw$. If you're not type cd $LJHOME.
    • if you want to work in dw-nonfree you need to be in ~/dw/ext/dw-nonfree$. If you're not type cd $LJHOME/ext/dw-nonfree
  • Then make sure you're in the develop branch using the checkout command:
git checkout develop
  • Now you can create a new branch specifically dedicated to the bug you want to work on using the branch command.
git branch BRANCHNAME
N.B. It is best if you use the bug number and a short description as your branch name: bug####/short_description
  • To switch to this branch, use the checkout command again:
git checkout BRANCHNAME
  • You can also create and switch to a branch at the same time using:
git checkout -b BRANCHNAME
  • Finally you can also create and switch to a branch and make sure it stems from develop using:
git checkout -b BRANCHNAME develop
  • And that's it. Now you can start coding!


Work, work, work (in WinSCP and your editor)

  • In WinSCP right click to edit the file you want to work on.
  • Remember that the free part of the code is in ~/dw/* while the non-free part is in ~/dw/ext/dw-nonfree/*.
  • If you're working on site pages, you're working on .bml files. These are in ~dw/htdocs/ or one of the subsequent folders. You'll see that their names correspond to the URLs of site pages. These files may use .pm modules/widgets which are in ~dw/cgi-bin/LJ/ or ~dw/cgi-bin/DW/.
  • For text strings which are not in ~dw/htdocs/xxx.bml.text files, see ~dw/bin/upgrading/en.dat.
  • For more specific searches, you can use the grep command in PuTTY: grep [option(s)] pattern [file(s)]

Interesting options:

-E: match using extended regular expressions

-F: match using fixed strings

-r: recursive

-i: case insensitive

-l: filename only

-n: add relative line number

Examples:

grep -ri "find this text" * | more
This will search for "find this text" in all files and display it page by page.
grep -ril "find this text" * | more
This will search for "find this text" in all files but only display the relevant filenames and not any excerpts.
grep -rl print_entry $LJHOME/bin/upgrading/s2layers
This will search for files containing "print_entry" in the /s2layers folder, and only display the filenames as results.


Test your changes on your Dreamhack (in PuTTY and your Dreamhack)

  • In PuTTY, stop your Dreamhack:
stop-apache
  • Update your database by typing this or dwdb:
$LJHOME/bin/upgrading/update-db.pl -r -p --innodb
$LJHOME/bin/upgrading/update-db.pl -r --cluster=all --innodb
$LJHOME/bin/upgrading/texttool.pl load
  • Start your Dreamhack again:
start-apache
  • Go to your Dreamhack and test. Edit the files again in WinSCP if more changes are needed. Go through these steps again to test your new changes.


Mark your local changes as ready to be committed (in PuTTY)

Before being committed, work is moved to a staging area. Think of it as the "Ready? Steady?" before the "Go!". At this point nothing is definite and you can easily change things.

  • You can add your changes to the staging ('pre-commit') area using the add command:
git add FILENAME
  • To add all files which have been updated at once you can use:
git add -u
  • To add all files which have been added or updated at once use this instead:
git add .
  • If you realize you need to do some more work, edit files again and use add again when you're done. It's that simple.


Commit your changes locally (in PuTTY)

  • If you think you're done with your work at this point you can commit your changes locally using the commit command:
git commit
  • This will open the nano editor so you can type a commit message. Unfortunately, nano isn't very easy to type into (you can't use the number pad for instance) so I advise you to type your commit message in your text editor then paste it in nano (right click in PuTTY to paste).
  • Here's an example of commit message (no blanks between lines, though):

Bug #123 - Subject

Bugzilla URL

Patch description

Description can go on several short lines.

  • Hit Ctrl+X, 'y' then enter to save your message.
  • If you you need to do some more work later you can update your commit using --amend:
git commit --amend
N.B. You can also do this if you need to edit your commit message.
  • If you want to pace yourself or be easily able to go back to a certain point in your work you can do successive commits instead of one big final one.


Go from local to the World Wide Web (in PuTTY)

Push the changes to your github.com repository

You should only push your local changes to your develop branch on github.com once you're happy with your patch and won't go back to it again as it's harder to change things from this point on.

If you're sure use the push command and the branch name:

git push origin BRANCHNAME


Request your changes to be pulled into the main code (on github.com)

On your GitHub page, click on the correct repository (dw-free or dw-nonfree), select the correct branch in the branch drop-down menu (below 'Clone in Windows') then click on Pull Request below.

N.B. If there's a delay between the moment you pushed your branch and the moment it appears on GitHub, check its status page, wait and refresh. (^_^)


Mention the pull request (on Bugzilla)

  • Comment on the bug with a link to your pull request.
  • Wait for someone to review and commit your patch. You're done! \o/


More: deeper understanding of the workflow

If you want to understand the workflow better I suggest reading the 'workflow', 'add & commit" and 'pushing changes' sections of Git - The Simple Guide. It has very simple, clear explanations and a drawing, which helps.


More: checking things (in PuTTY)

  • To check which local branch you're on (noted with an asterisk):
git branch
  • To see local and remote branches:
git branch -a
  • To have a detailed view of local and remote branches:
git branch -v -a
  • To see the changes you've made on the branch before you move them to the staging area:
git diff
  • To see the changes you've made on the branch before a commit:
git diff --cached
  • To see the list of files you've added, removed, modified on the branch before a commit:
git status -s
  • To see a tree-like view of commits in develop:
git log --graph --oneline --all
To exit this view, hit the 'q' key.


More: stashing your changes (in PuTTY)

If you have work you haven't committed yet and you want to work on another bug or update your 'master' and 'develop' branches you need to stash your work first. It's generally good practice to do this every time you have work you haven't committed.

  • Make sure you're on the right branch using the checkout command.
  • Put away your work using the stash command:
git stash
  • And bring it back with:
git stash pop
  • To see the work you've stashed, you can use:
git stash show


More: Undoing changes (in PuTTY)

  • If you added a file using git add but finally want to unstage it (i.e. remove it from the staging area before you do git commit), you can use the reset command:
git reset HEAD FILENAME
Note that the file is still modified; it's just no longer part of your staging area and won't be part of your commit.
  • If you want to undo the changes you've made to a file before you commit it, you need to use checkout:
git checkout -- FILENAME
  • You can also reset everything to the last commit using --hard:
git reset --hard


More: moving files (in PuTTY)

Use the mv command:

git mv OLDPATH NEWPATH


More: deleting files (in PuTTY)

Use the rm command:

git rm FILEPATH


More: deleting branches (in PuTTY)

  • Once your work on a bug is done and your branch has been merged into develop you can delete your local branch:
git branch -d BRANCHNAME
You can also use this to delete a local branch you've created by mistake.
  • If your whole branch hasn't been merged, you must use this instead:
git branch -D BRANCHNAME
  • You can then delete your remote branch as well:
git push origin :BRANCHNAME


More: renaming branches (in PuTTY)

If you've made a mistake and want to rename a local branch, you can use:

git branch -m OLDNAME NEWNAME
N.B. This will work even if you've committed and pushed some changes already. However, if you have, it will not rename the branch on your GitHub fork but create a new identical one. You will need to delete the old branch on GitHub.


More: troubleshooting tips

Issues with text strings

  • As [info]denise explained here, you need to delete old text strings and create new ones when you edit .text files or en.dat instead of simply editing the text. If the change isn't critical - the string doesn't need to be renamed or the text change is minor - it's better to notify the site copy team so that text can be changed locally and the original file left alone.
  • If text you've modified doesn't appear on the site after a code push, append ?uselang=debug to the page URL to make sure it's using the right string. If it is and it still doesn't display after a while, comment on [info]dw_maintenance.

Starting over

If something's really wrong you can:


References