phpBB

Development Wiki

Difference between revisions of "Working with Git"

From phpBB Development Wiki

m (Windows)
(Sort out windows section, restructure)
Line 1: Line 1:
= Basics =
+
This gives some documentation on using git for phpBB development, details of the phpBB [[Git|git infrastructure]] documents the repositories and branches available for use.
  
== Cloning ==
+
= Command Line =
Clone the master phpBB3 repository.
+
 
 +
== Basics ==
 +
 
 +
=== Cloning ===
 +
Clone the main phpBB3 repository.
 
<pre>git clone git://github.com/phpbb/phpbb3.git</pre>
 
<pre>git clone git://github.com/phpbb/phpbb3.git</pre>
  
== Branches ==
+
=== Branches ===
  
* '''master''': Mainline for releases
+
See [[Git#Branches|phpBB3 Branches]]
* '''develop''': Development branch for the next feature release
+
* '''develop-olympus''': Development branch of named release
+
  
= Developers =
+
== Developers ==
  
 
Developers should fork a copy of the repository on GitHub from [http://github.com/phpbb/phpbb3] and then clone as instructed by GitHub.
 
Developers should fork a copy of the repository on GitHub from [http://github.com/phpbb/phpbb3] and then clone as instructed by GitHub.
  
== Configuration ==
+
=== Configuration ===
 
* E-mail address: <pre>git config --add user.email username@phpbb.com</pre>
 
* E-mail address: <pre>git config --add user.email username@phpbb.com</pre>
 
* Add the upstream remote (you can change 'upstream' to whatever you like): <pre>git remote add upstream git://github.com/phpbb/phpbb3.git</pre>
 
* Add the upstream remote (you can change 'upstream' to whatever you like): <pre>git remote add upstream git://github.com/phpbb/phpbb3.git</pre>
  
== Creating local branches ==
+
=== Creating local branches ===
 
To work on phpBB you need to create local branches of whichever '''develop''' branches you need, issue the following command to perform this operation:
 
To work on phpBB you need to create local branches of whichever '''develop''' branches you need, issue the following command to perform this operation:
 
<pre>git checkout -b develop origin/develop</pre>
 
<pre>git checkout -b develop origin/develop</pre>
  
== Work flows ==
+
=== Work flows ===
  
=== Pulling in upstream changes ===
+
==== Pulling in upstream changes ====
 
You will need to merge in changes made to the upstream repository for them to appear in your fork, the steps to do this follow. I'm assuming you are performing this on the '''develop''' branch, but it could be a bug fix branch or a develop release branch, so ensure you are on the correct branch using git branch and change with git checkout if required.
 
You will need to merge in changes made to the upstream repository for them to appear in your fork, the steps to do this follow. I'm assuming you are performing this on the '''develop''' branch, but it could be a bug fix branch or a develop release branch, so ensure you are on the correct branch using git branch and change with git checkout if required.
  
Line 31: Line 33:
 
# Push the changes back to your fork (substitute develop for the current branch): <pre>git push origin develop</pre>
 
# Push the changes back to your fork (substitute develop for the current branch): <pre>git push origin develop</pre>
  
=== Bug fixing ===
+
==== Bug fixing ====
 
Ensure you are using the correct ''develop'' branch first and not a ''master'' branch.
 
Ensure you are using the correct ''develop'' branch first and not a ''master'' branch.
  
Line 41: Line 43:
 
# git push origin bug/12345 # Push the branch back to github[/list]
 
# git push origin bug/12345 # Push the branch back to github[/list]
  
== Windows ==
+
= Windows =
 
Quick info for those with TortoiseGit (and used to working with TortoiseSVN)
 
Quick info for those with TortoiseGit (and used to working with TortoiseSVN)
  
Create your own SSH key<br />
+
== Create your own SSH key ==
''Note: I used the OpenSSH option during installation, so I am not sure if this works for the other option or if you are supposed to do it some other way''<br />
+
 
http://help.github.com/msysgit-key-setup/<br />
+
http://help.github.com/msysgit-key-setup/
TortoiseGit will automatically use the SSH key<br />
+
 
<br />
+
TortoiseGit will automatically use the SSH key
Then simply clone the repository to your local system and the rest is mostly like TortoiseSVN.<br />
+
 
<br />
+
''Note: I used the OpenSSH option during installation, so I am not sure if this works for the other option or if you are supposed to do it some other way''
Pull - Grab the updates from upstream<br />
+
 
Commit - Commits the changes '''locally''' (you must Push or Sync to commit the changes to the repository)<br />
+
== Clone ==
Push - Pushes the changes that were locally made into the repository<br />
+
 
Sync - Pushes/Pulls changes with more options<br />
+
Then simply clone the repository to your local system and the rest is mostly like TortoiseSVN.
<br />
+
 
 +
== Commands ==
 +
 
 +
;Pull
 +
:Grab the updates from upstream
 +
;Commit
 +
:Commits the changes '''locally''' (you must Push or Sync to commit the changes to the repository)
 +
;Push
 +
:Pushes the changes that were locally made into the repository
 +
;Sync
 +
:Pushes/Pulls changes with more options
 
[[Category:Development|Git]]
 
[[Category:Development|Git]]
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Revision as of 12:09, 3 March 2010

This gives some documentation on using git for phpBB development, details of the phpBB git infrastructure documents the repositories and branches available for use.

Command Line

Basics

Cloning

Clone the main phpBB3 repository.

git clone git://github.com/phpbb/phpbb3.git

Branches

See phpBB3 Branches

Developers

Developers should fork a copy of the repository on GitHub from [1] and then clone as instructed by GitHub.

Configuration

  • E-mail address:
    git config --add user.email username@phpbb.com
  • Add the upstream remote (you can change 'upstream' to whatever you like):
    git remote add upstream git://github.com/phpbb/phpbb3.git

Creating local branches

To work on phpBB you need to create local branches of whichever develop branches you need, issue the following command to perform this operation:

git checkout -b develop origin/develop

Work flows

Pulling in upstream changes

You will need to merge in changes made to the upstream repository for them to appear in your fork, the steps to do this follow. I'm assuming you are performing this on the develop branch, but it could be a bug fix branch or a develop release branch, so ensure you are on the correct branch using git branch and change with git checkout if required.

  1. Pull the changes from the upstream develop branch:
    git pull upstream develop
  2. Push the changes back to your fork (substitute develop for the current branch):
    git push origin develop

Bug fixing

Ensure you are using the correct develop branch first and not a master branch.

  1. git branch bug/12345 # Create a new branch for your bug fix
  2. git checkout bug/12345 # Switch to the new branch
  3. Make your changes
  4. git add <files> # Stage the files
  5. git commit -m "Message" # Commit staged files
  6. git push origin bug/12345 # Push the branch back to github[/list]

Windows

Quick info for those with TortoiseGit (and used to working with TortoiseSVN)

Create your own SSH key

http://help.github.com/msysgit-key-setup/

TortoiseGit will automatically use the SSH key

Note: I used the OpenSSH option during installation, so I am not sure if this works for the other option or if you are supposed to do it some other way

Clone

Then simply clone the repository to your local system and the rest is mostly like TortoiseSVN.

Commands

Pull
Grab the updates from upstream
Commit
Commits the changes locally (you must Push or Sync to commit the changes to the repository)
Push
Pushes the changes that were locally made into the repository
Sync
Pushes/Pulls changes with more options