Loading...
 

Git workflow for versioning local changes

General concept


This is not the simplest use-case but it is very common for people who want a reasonable guarantee that their production Tiki will work with no regression, and who want to be able to use versioning for rolling back in case anything is wrong.
We have two environments (or more).

  • DEV is a Tiki server for improving the Tiki site. It may break sometimes before it gets better. It gets updates from the official Tiki repo (-+upstream+-) and it pushes updates and local changes to the local repo (-+origin+-).
  • PROD is the production Tiki which should only be updated from origin after everything was tested on DEV or on another server like a preprod or acceptance Tiki instance. preprod or acceptance are out of the scope of this document and will not be mentioned again.

Image

Let's imagine a Tiki site running Tiki 22.x

Set up the whole environment

Create empty local repository


This will hold a full Tiki repo, plus local changes such as custom theme, custom templates, logos and favicons, local improvements not yet contributed to the community or contributed in another branch (like contributed in master while running 22.x)

For instance let's create a local_repository repo on gitlab with options:
x Public
x Not initialised

The URL is : git at gitlab.com:xxxxx/local_repository.git

Clone project for DEV


Get a full repo (yes, it's big) from official sources.

dev:~$ git clone https://gitlab.com/tikiwiki/tiki.git dev_tiki22


We now have a full repo in folder dev_tiki22 (place folder as suits your local environment)

Rename repos

dev:~/dev_tiki22$ git remote
origin

dev:~/dev_tiki22$ git remote rename origin upstream
dev:~/dev_tiki22$ git remote add origin git@gitlab.com:xxxxx/local_repository.git

dev:~/dev_tiki22$ git remote -v
origin  git@gitlab.com:xxxxx/local_repository.git (fetch)
origin  git@gitlab.com:xxxxx/local_repository.git (push)
upstream        https://gitlab.com/tikiwiki/tiki.git (fetch)
upstream        https://gitlab.com/tikiwiki/tiki.git (push)

Fill local repo (origin)

dev:~/dev_tiki22$ git fetch --all
Fetching upstream
Fetching origin

dev:~/dev_tiki22$ git push -u origin --all
Counting objects: 549383, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (133718/133718), done.
Writing objects: 100% (549383/549383), 1.32 GiB | 7.90 MiB/s, done.
Total 549383 (delta 430804), reused 525638 (delta 410223)
remote: Resolving deltas: 100% (430804/430804), done.
remote: Checking connectivity: 549383, done.
To gitlab.com:xxxxx/local_repository.git
 * [new branch]            22.x -> 22.x
Branch '22.x' set up to track remote branch '22.x' from 'origin'.


Could anyone explain why we end up in 22.x instead of master?

Set local GIT repo as default repo

This section is unfinished. Help would be appreciated.


We want that checkouts and pull and push default to origin instead of upstream

This is wrong
dev:~/dev_tiki22$ git checkout 21.x
Branch '21.x' set up to track remote branch '21.x' from 'upstream'.
Switched to a new branch '21.x'

dev:~/dev_tiki22$ git push -u origin --all
Branch '22.x' set up to track remote branch '22.x' from 'origin'.
Branch '21.x' set up to track remote branch '21.x' from 'origin'.


All is fixed now but creating a new branch sets it to upstream again instead of origin. This is an accident waiting to happen (pushing local stuff on the official Tiki repository). any idea?

This is wrong and dangerous
dev:~/dev_tiki22$ git checkout 19.x
Branch '19.x' set up to track remote branch '19.x' from 'upstream'.
Switched to a new branch '19.x'


We need to remember to run

git push -u origin --all

Set up production environment: PROD


We can save space by installing a light source version with no history.

prod$ git clone --depth=1 --branch=22.x git@gitlab.com:xxxxx/local_repository.git tiki_prod_22

Make local changes in DEV and get them in PROD

Make a sample change in DEV

dev:~/dev_tiki22$ cp templates/tiki-listpages.tpl themes/templates
dev:~/dev_tiki22$ git status
On branch 22.x
Your branch is up to date with 'origin/22.x'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        themes/templates/tiki-listpages.tpl

dev:~/dev_tiki22$ git commit themes/templates/tiki-listpages.tpl -m "First local modification"

dev:~/dev_tiki22$ git push

Update PROD with the new change

dev:~/dev_tiki22$ git pull

Get new improvements from upstream

Update DEV

dev:~/dev_tiki22$ git pull --rebase --autostash

(needs testing and confirmation)

Update PROD


After some testing in DEV, update PROD

prod:~/repo_prod_22$ git pull

TODO


Use tags for updating PROD. That would make rolling back PROD easier.

Keywords

The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting
Administration
Ajax
Articles & Submissions
Backlinks
Banner
Batch
BigBlueButton audio/video/chat/screensharing
Blog
Bookmark
Browser Compatibility
Calendar
Category
Chat
Comment
Communication Center
Consistency
Contacts Address book
Contact us
Content template
Contribution
Cookie
Copyright
Credits
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Diagram
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs
DogFood
Draw -superseded by Diagram
Dynamic Content
Preferences
Dynamic Variable
External Authentication
FAQ
Featured links
Feeds (RSS)
File Gallery
Forum
Friendship Network (Community)
Gantt
Group
Groupmail
Help
History
Hotword
HTML Page
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Import-Export
Install
Integrator
Interoperability
Inter-User Messages
InterTiki
jQuery
Kaltura video management
Karma
Live Support
Logs (system & action)
Lost edit protection
Mail-in
Map
Menu
Meta Tag
Missing features
Visual Mapping
Mobile
Mods
Modules
MultiTiki
MyTiki
Newsletter
Notepad
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Packages
Payment
PDF
Performance Speed / Load / Compression / Cache
Permission
Poll
Profiles
Quiz
Rating
Realname
Report
Revision Approval
Scheduler
Score
Search engine optimization (SEO)
Search
Security
Semantic links
Share
Shopping Cart
Shoutbox
Site Identity
Slideshow
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Spellcheck
Spreadsheet
Staging and Approval
Stats
Survey
Syntax Highlighter (Codemirror)
Tablesorter
Tags
Task
Tell a Friend
Terms and Conditions
Theme
TikiTests
Timesheet
Token Access
Toolbar (Quicktags)
Tours
Trackers
TRIM
User Administration
User Files
User Menu
Watch
Webmail and Groupmail
WebServices
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives
WYSIWTSN
WYSIWYCA
WYSIWYG
XMLRPC
XMPP




Useful Tools