Differences between revisions 5 and 6
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

  <<TableOfContents>>

= General Tips and Tricks =

== How to permanently remove large files from a Git repository ==

This explains how to permanently delete files from a git repository. This would be necessary if yo uchecked in a large file by accident and don't want other developer to have to download the entire history, including the deleted file.

 * See also: http://www.somethingorothersoft.com/2009/09/08/the-definitive-step-by-step-guide-on-how-to-delete-a-directory-permanently-from-git-on-widnows-for-dumbasses-like-myself

=== Example Problem ===

 1. Your local development repository is at /home/user/projects/v2p0
 1. The server repository is at git.softxs.ch://home/git/gitroot/v2p0.git
 1. You accidentally committed a sub-tree full of files into v2p0 at public/assets

=== Procedure ===

==== Overview ====
 
 1. Create a temporary repository
 1. Remove entire sub-directory and its history with the '''git filter-branch''' command
 1. Clone the result into a new (clean) local git repository
 1. Replace the git repository on the git server with the new clean repository
 
Create a temporary repository

  {{{
cd /tmp
git clone alan@git.softxs.ch:/home/git/gitroot/v2p0.git
cd v2p0

git count-objects -v
count: 42
size: 168
in-pack: 610
packs: 1
size-pack: 58542 <-- This gives the size of the repository, which is 58MB
prune-packable: 0
garbage: 0
  }}}

Remove entire sub-directory and its history with the '''git filter-branch''' command

  {{{
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch public/assets' HEAD
git gc --pune=now
  }}}

Clone the result into a new (clean) local git repository

  {{{
cd ..
mv v2p0 v2p0-BLOATED
mkdir v2p0
cd v2p0
git init
git pull file:///tmp/v2p0-BLOATED

git count-objects -v
...
size-pack: 137 <-- Reduced to 137 kb!
  }}}

Replace the git repository on the git server whith the new clean repository

  {{{
  }}}
 
= DrawMGT Tips and Tricks =

Tricks and tips Administering DrawMGT

General Tips and Tricks

How to permanently remove large files from a Git repository

This explains how to permanently delete files from a git repository. This would be necessary if yo uchecked in a large file by accident and don't want other developer to have to download the entire history, including the deleted file.

Example Problem

  1. Your local development repository is at /home/user/projects/v2p0
  2. The server repository is at git.softxs.ch://home/git/gitroot/v2p0.git
  3. You accidentally committed a sub-tree full of files into v2p0 at public/assets

Procedure

Overview

  1. Create a temporary repository
  2. Remove entire sub-directory and its history with the git filter-branch command

  3. Clone the result into a new (clean) local git repository
  4. Replace the git repository on the git server with the new clean repository

Create a temporary repository

  • cd /tmp
    git clone alan@git.softxs.ch:/home/git/gitroot/v2p0.git
    cd v2p0
    
    git count-objects -v
    count: 42
    size: 168
    in-pack: 610
    packs: 1
    size-pack: 58542  <-- This gives the size of the repository, which is 58MB
    prune-packable: 0
    garbage: 0

Remove entire sub-directory and its history with the git filter-branch command

  • git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch public/assets' HEAD
    git gc --pune=now

Clone the result into a new (clean) local git repository

  • cd ..
    mv v2p0 v2p0-BLOATED
    mkdir v2p0
    cd v2p0
    git init
    git pull file:///tmp/v2p0-BLOATED
    
    git count-objects -v
    ...
    size-pack: 137            <-- Reduced to 137 kb!

Replace the git repository on the git server whith the new clean repository

DrawMGT Tips and Tricks

How to regenerate all thumbnails

Assumed all thumbnails should be regenerated:

$ cd pub/thumbnails
$ rm *
mysql -uroot -psqladmin {database}
mysql> update Revisions set sourceThumbnail = null, publishThumbnail = null, file3Thumbnail = null, file4Thumbnail = null, file5Thumbnail = null, file6Thumbnail = null;
mysql> update Events set stateId = 3, attemptNo = null, runDatetime = null where objectTypeId = 2 and eventTypeId = 24;

After the database changes the Event Daemon will regenerate the thumbnail files.

How to recreate database triggers after database changes

If it is necessary to recreate database triggers after database changes must be ensured that the triggers will have the same character set settings as the database. Otherwise unpredictable behavior can occur (every time a trigger is called, than 'show variables like "character_set_results";' reports changed character set). The achieve this , don't forget to use the "set names ..." command. Assumed the database is hcmc2140test and the character set is utf8:

$ cd {project root}
$ mysql -uroot -psqladmin hcmc2140test
mysql> set names utf8;
mysql> source var/hcmc2/zg.softxs.ch-test/schema/drawmgt-versioning-schema.sql
mysql> source var/hcmc2/zg.softxs.ch-test/schema/drawmgt-versioning-trigger.sql

Trigger character set can be checked with the command:

mysql> select EVENT_OBJECT_TABLE, TRIGGER_NAME, CHARACTER_SET_CLIENT, COLLATION_CONNECTION, DATABASE_COLLATION from information_schema.TRIGGERS where EVENT_OBJECT_SCHEMA = 'hcmc2140prod' [ and TRIGGER_NAME = 'upd_Users' ];

Database character set can be checked with the command:

mysql> select SCHEMA_NAME, DEFAULT_CHARACTER_SET_NAME, DEFAULT_COLLATION_NAME from information_schema.SCHEMATA [ where SCHEMA_NAME = 'hcmc2140test' ];

Table character set can be checked with the command:

mysql> select TABLE_COLLATION from information_schema.TABLES where TABLE_SCHEMA = 'linthal140dev1' [ and TABLE_NAME = 'Drawings' ];

TipsAndTricks (last edited 2013-02-04 19:33:18 by 10)

Copyright 2008-2014, SoftXS GmbH, Switzerland