set up a wiki (or a blog) using ikiwiki and gitosis

  1. Create your ikiwiki wiki as usual, in the machine which will store the main (gitosis) repo. You'll end up with a bare repo (wiki.git), a normal repo (wiki) and an ikiwiki setup file (wiki.setup).

  2. Create the repo on the server side (gitosis). Add the repo name to the gitosis.conf file. Save, commit, and push the change.

  3. Move the bare repo to the folder where all gitosis folders are kept. Change the owner to the gitosis user.

  4. Move the normal repo to wherever you want to keep it.

  5. Inside the normal repo, edit the .git/config file and change the origin url to the new filesystem location of the bare repo. (Usually something like /home/gitosis/repositories/your-git.git).

  6. Edit the location of the git_wrapper script in the wiki.setup file, to the new location of the bare repo. Check also the srcdir and destdir config. values.

  7. Change the owner of both the normal repo (wiki) and the HTML destdir (~/public_html/wiki, usually), to the gitosis user.

  8. Run the command ikiwiki --setup wiki.setup

That's all (IIRC)

git log

see all the commits to a file starting from the head of a given branch

git log <branch> -- <file>

change/undo a commit

This is only recommended when you have not made public the commits you want to change/delete

Say you are in the branch master, which tracks remotes/origin/master, and you want to make some changes to a commit in master which isn't yet in the corresponding remote. Do this

git rebase -i -- remotes/origin/master

git will open an editor, with a list of the not-yet-pushed commits. Change the pick in the commit you want for a edit, write and close the editor.

git will leave your tree right in top of the offending commit. Do the changes you need to do, add them to the index, and do a

git commit --amend

to merge the added changes with the current commit. Once you do that, finish the rebase operation with

git rebase --continue

gitosis

Create a new repository

  1. Add the repo in gitosis.conf (in the writable section of some group). Commit and push.
  2. Create a local repo in another machine (let's call it devbox)

    # These two steps are not needed if you already have the git repo
    # (like when migrating one)
    git init
    # do at least one commit
    
    
    git remote add origin gitosis@git.devnull.li:YOUR_REPO_NAME.git
    git push origin master:refs/heads/master
    
  3. ssh to git.devnull.li, edit /var/cache/git/pl.txt, add a line with the name of the repo: YOUR_REPO_NAME.git

  4. in devbox, in your repo, execute the two following commands

    git config branch.master.remote origin
    git config branch.master.merge refs/heads/master
    

export a git repository to subversion

We'll cover only exporting a git repo created via git-svn.

  1. Create an empty svn repo. We'll call it svn-repo.

    svnadmin create svn-repo
    
  2. Make a dummy commit on it, using svn.

  3. Clone the new repository using git svn clone.
  4. Find the commits numbers of:

    1. The first (and only) commit of the new svn repo.
    2. The first commit of the git repo you want to migrate.

    Create a file .git/info/grafts