1 Working With the LBW Web Site
\r
2 =============================
\r
8 You need a POSIX environment, i.e. some variety of Linux/Unix, OS X or Cygwin
\r
9 with a Bash-like shell.
\r
11 1. Install [Git] [1] via your distribution's package manager.
\r
13 2. Install Perl and the Perl [Template Toolkit] [2] library via your package
\r
17 Initial Repository Setup
\r
18 ------------------------
\r
20 You need to do these steps once before making any changes to the site.
\r
22 1. Clone the Git repository:
\r
24 git clone https://linuxbierwanderung.com/lbwsite.git
\r
26 This will create a directory 'lbwsite' in the current directory. This is
\r
27 is your working copy of the repository. Note that this not only contains
\r
28 the latest version of the repo but is a separate repository in its own right
\r
29 with the whole change history and all branches (see below) existing at the
\r
30 time of the checkout.
\r
32 The repository you created the clone from is a so-called "remote" and named
\r
33 "origin" by convention. It is the default target when you upload your
\r
34 changes with `git push` and when you retrieve changes by others with `git
\r
35 pull` (or `fetch`). You can list the defined remote repositories with:
\r
39 2. Change into the `lbwsite` directory.
\r
41 3. Create a new branch for your changes::
\r
43 git checkout -b <new-branch-name>
\r
45 Use something like "feature/newdesign" or "bugfix/headerlayout" as the branch
\r
46 name. This step is optional but highly recommended, since it makes it much
\r
47 easier to submit or create a patch of your changes later and to synchronize
\r
48 to the master repository while keeping your changes separate while working on
\r
49 them. Creating a branch also automatically "activates" it, so when you commit
\r
50 any changes, they are commited to this branch.
\r
52 You can list the existing branches with::
\r
56 The default branch which should exist in every (new) repository is called
\r
59 You can change between branches with:
\r
61 git checkout <branch-name>
\r
63 Yes, I know, it's silly that the command is also called checkout. That's Git
\r
70 Open a shell, change into the `lbwsite` directory and run:
\r
74 This does a few things:
\r
76 1. It creates the output directory `out` beneath the current directory (and
\r
77 deletes) an existing one.
\r
78 2. Copies the background images to it.
\r
79 3. Builds the site from the template files in `src` via the `ttree` command,
\r
80 using the file `ttreerc` as the configuration.
\r
81 4. Creates a new empty git repository in `out/lbwsite.git`.
\r
82 5. Mirrors your repository in `lbwsite` into `out/lbwsite.git`.
\r
83 6. Does some Git repository adminstrative stuff.
\r
85 You can view the generated site by opening `out/index.html` in your browser.
\r
91 Open a shell, change into the `lbwsite` directory and make sure your repository
\r
92 has the latest changes from the "origin" remote repository:
\r
96 This will fetch changes from the "origin" and update your working copy with
\r
97 them (i.e. merge them with your changes). `git pull` is shorthand for `git
\r
98 fetch` followed by `git merge FETCH_HEAD`.
\r
100 Then make your changes to the source files under the `src` directory.
\r
102 ### Updating Your Branch
\r
104 (Ignore this section if you do not use your own branch.)
\r
106 Note that `git pull` only works on the currently active branch. If you have
\r
107 created and activated a new branch to work on your changes, you need to change
\r
108 to (activate) the "master" branch to merge the remote changes into your local
\r
111 git checkout master
\r
114 If this pulls any changes and you want to include them into your branch,
\r
115 activate your branch and merge the new changes from the "master" branch into
\r
118 git checkout <my-branch>
\r
122 ### Commiting Changes
\r
124 You can check which files have changed or which are new with:
\r
128 Note that the file `.gitignore` defines patterns for files and directories
\r
129 whose changes are ignored. The output directory `out` is listed in there, so
\r
130 the generated site files to not show up with `git status`.
\r
132 To see *what* has changed:
\r
136 This will give you a unified diff of changes that have not been *added* (see
\r
139 If you are happy with a change, you need to *commit* it. This registers a
\r
140 *changeset* in *your local* repository. To distribute the change to others,
\r
141 you'll either need to *push* these changes to another (remote) repository (if
\r
142 you're allowed to) or prepare a patch and send to someone, e.g. via email.
\r
144 Before you can commit changes to a file (or several) you need to *add* the
\r
145 file(s) to the *staging area*, i.e. the collection of changes which will be
\r
146 commited with the next `commit` command. You can either specify the file(s) to
\r
151 or add all changed files, even newly created ones, which hadn't been under
\r
152 version control yet, with:
\r
156 You have to repeat the `add` command after each new change, which you want to
\r
157 go into the next commit. Check with `git status` regularly for any un-added
\r
158 changes, esp. before issuing the `commit` command. To see a diff of the changes
\r
159 that go into the next commit:
\r
163 Before you commit, rebuild the site and check that everything works as
\r
166 Finally, commit your changes, giving a meaningful (!) log message:
\r
168 git commit -m "Fixed URL in README file"
\r
170 This will commit all added changes.
\r
172 Repeat the edit, `git add`, `git commit` cycle for each change that constitutes
\r
173 a defined, separate change (how much goes into each commit is a philosophical
\r
174 discussion not touched here).
\r
177 Distributing Your Changes
\r
178 -------------------------
\r
180 How this is done depends on whether you have write access to the "origin" (see
\r
181 above) remote repository or not.
\r
183 If you don't, you can pack up a series of commits into a bundle, suited for
\r
184 sending via email with:
\r
186 git bundle create my-branch.bundle master..<my-branch>
\r
188 This will make a bundle with all changes/commits that separate your branch from
\r
189 the "master" branch. Send the `my-branch.bundle` file to the owner of the
\r
190 "origin" repository and (s)he'll hopyfully know what to do with it and merge
\r
193 *This section to be continued...*
\r
196 [1]: https://git-scm.com/
\r
197 [2]: http://www.template-toolkit.org/
\r