cd
git clone git@git.php.net:php-src.git
or if you're behind firewall
cd
git clone https://git.php.net/repository/php-src.git
Find git-new-workdir script, usually located in contrib folder in the git-core package. If you're on Ubuntu like me, you can find it this way:
conf@laptop ~/php5.3 $ locate git-new
/usr/share/doc/git/contrib/workdir/git-new-workdir
conf@laptop ~/php5.3 $
This script creates several working copies sharing the same git repository, just as we need. I.e. if you make some commits in any working copy, they're available in all copies instantly. Read how it works here: http://nuclearsquid.com/writings/git-new-workdir/
Make working copies for 5.3 and 5.4 branch, assume that we use php-src for master:
conf@laptop ~ $ bash /usr/share/doc/git/contrib/workdir/git-new-workdir ./php-src ./php5.3 PHP-5.3
Already on 'PHP-5.3'
conf@laptop ~ $ bash /usr/share/doc/git/contrib/workdir/git-new-workdir ./php-src ./php5.4 PHP-5.4
Switched to branch 'PHP-5.4'
conf@laptop ~ $
Now you have your PHP5.3 branch checked out in ~/php5.3, PHP5.4 in ~/php5.4 and master in ~/php-src.
cd ~/php-5.3
git checkout -b mybranch
[edit files]
git diff
git add <new files>
git commit -am 'Some really relevant commit message.'
cd ~/php-5.3
git fetch # download all remote changes but do not apply them
git checkout PHP-5.3 # make sure each working copy is on its release branch
git pull # that's easier to write than git merge origin/PHP-5.3, although it calls remote repo one more time
cd ~/php-5.4
git checkout PHP-5.4
git pull
cd ~/php-src
git checkout master
git pull
cd ~/php5.3
git checkout mybranch
git rebase PHP-5.3
cd ~/php5.3 # if you're not here yet
git checkout PHP-5.3
git merge --no-ff mybranch
git diff origin/PHP-5.3 # review changes
cd ~/php-5.4
git checkout PHP-5.4
git merge --no-ff PHP-5.3
git diff origin/PHP-5.4
cd ~/php-src
git checkout master
git merge --no-ff PHP-5.4
git diff origin/master
git push origin