avp::ptr weblog

Everything that is in our mind.

How to create an independent branch in git?

without comments

While working with a version control system like git it is sometimes a good idea to create an independent branch. This article shows how to accomplish that. In this example I want to hold onto the documentation in a separate branch.
I assume, that you already created a repository and added various commits onto you master branch.

Prepare your ignore list
Now its time to prepare for the repository. First, edit your .gitignore file and exclude the doc/ folder which you will be creating in the next step.

Create an orphan branch
Create a new independent branch with the git checkout option --orphan. The option is available since Git 1.7.2. Initially, you will have to remove the files that have been created in the working directory, but right after the branch is independent.
Now you can create a doc/ folder and create documentation files. In the end you can commit them to the repository as usual.

git checkout --orphan documentation
git rm -rf .
mkdir doc
cd doc
// Do work.
// git add your files to the doc/ folder
git commit -m "Added documentation files."

Checkout the master branch
To checkout the master branch while still being able to list the documentation files do the following.

git checkout master && git merge --no-commit documentation
git reset master

The files added to the documentation branch earlier will appear in the working directory visible to the master branch. Thanks to the .gitgnore file they will not be listed as untracked files.

The initial discussion on an unrelated branch can be found on stackoverflow.com. Thanks to hillutcovo and phord for their input!

Written by tobi

October 9th, 2011 at 5:16 pm

Posted in Uncategorized

Tagged with , , ,

How to manually install TeX Live 2011 and Kile 2.1.0

without comments

It took me a while to find out how to install the latest TeX Live 2011 package on my Ubuntu 10.10 system. So this is a short summary of my success story.

First of all, it is worth mentioning that the default PPA installs TeX Live 2009.

As of July 2011 the texlive package that ships with Ubuntu (TeX Live 2009) is lagging two years behind the current TeX Live release (TeX Live 2011). If you want the latest version of TeX Live, you can install it directly from the TeX Live website (this does not interfere with the packages in Ubuntu).

Though, it is not too difficult to manually install TeX Live 2011 from the sources following these instructions. In this process, I decided to download the TexLive package via rsync since it can be a rather big installation.

After successfully installing TeX Live itself, I set up the latest version of Kile (which is 2.1.0 as of today) following this description.

UPDATE!

Please mind that there is TexLive 2012 as described in a follow up article. There is also a PPA available to avoid the manual setup.

Written by tobi

October 8th, 2011 at 5:00 pm

Fixed permissions issue with redmine and gitosis

without comments

Some days ago I discovered that our gitosis install did not work with redmine anymore. I could push and pull changes but could not add a new ssh key. I thought it might be caused by the redmine upgrade I did, but it was some months ago and I haven’t had any problems. The redmine logs didn’t tell me anything either.
Yesterday, I started a new project. No problems with creating it in redmine and also no problems creating a git repository.
When I tried to push, gitosis gave an error. “Permission denied..” on some file.
I connected to the the gitosis server and checked the repository folder. There was a folder backup I made and it was not owend by the gitosis user. That was causing the error. After fixing ownership of that folder, everything works again as it should.

Written by peter

October 2nd, 2011 at 7:51 pm

Coloring differences at a word-level using gitk

without comments

Due to their default behavior to handle differences on a line-by-line level most of the version control systems seem to be impractical when writing texts others than source code. Also git highlights changes to text files line-wise.

After some research I found some nice options to improve things.

Coloring words using git diff

git diff --color-words

Coloring words using gitk

gitk --word-diff=plain
gitk --word-diff=porcelain
gitk --word-diff=color

The gitk parameter option seems to be new and/or undocumented since I could neither find it on the man page of gitk nor I did get it with the auto-completion. Please find further interesting thoughts in the discussion of András Salamon on StackExchange and Eduardo’s post. Also Iain Murray’s cwdiff wrapper might be worth taking a closer look.

Gitk differences colored at line-level

Gitk differences colored at line-level

Gitk differences colored at word-level

Gitk differences colored at word-level

Written by tobi

August 14th, 2011 at 1:08 am

How to set the ownerchip for NTFS partitions mounted from Ubuntu?

without comments

To mount an NTFS partition under Ubuntu you need to edit the configuration in /etc/fstab. Though, when successfully mounted there still is a good chance that the access rights to the partition are not as you want them to be. You cannot changed them with chmod command. Instead you need to set the umask for the mounted partition. In general umask 007 would be satisfying. But in case you run a service that reads from the partition as an anonymous user umask 006 is needed, e.g. an apache web server.

UUID=1973945397942 /media/data ntfs defaults,umask=006,uid=1000,gid=1000 0 0

You can find more information on umask here. This article was inspired by this post by Andrew Martin.

Written by tobi

July 29th, 2011 at 12:36 pm

How to disable the touchpad when the mouse is plugged in?

without comments

Today I finally took the time to ask Google how I can avoid that I hit the touchpad once in a while when I type something on the keyboard. As one would expect I am not the only person who is stressed by this. But there is an easy solution. Just install Touchpad-Indicator!

Written by tobi

July 12th, 2011 at 12:19 am

Posted in Uncategorized

Tagged with , , ,

How to configure the memory_limit for WordPress?

without comments

WordPress comes with a default memory limit of 32MB which can be to less if you run the automatic updates. As discussed here and here there are different ways to change the configuration. Though, for us it only works when we change the memory_limit in the following path:

/etc/php5/cgi/php.ini

Written by tobi

June 4th, 2011 at 9:14 pm

Posted in Uncategorized

Tagged with , , , ,

How to easily add gitignore settings?

without comments

Every project you run on git wants you to configure the gitignore settings for you IDE as well as specific exclusions for the programming language you use. To simplify the process of editing the .gitignore files you can now use a handy python script. Instead of manually editing the individual you simply download a collection of well known settings and pipe them into your .gitignore file.
Please feel free to use the script that adds global and local gitignore settings for you project published by Peter.
The script allows to choose between global and local settings. Use gitignore-rules-adder.py --help to find out how it works.

Written by tobi

April 8th, 2011 at 6:06 pm

Posted in Uncategorized

Tagged with , , , ,

Colored bash prompt showing git branch (.bash_rc)

without comments

Written by tobi

March 11th, 2011 at 3:31 am

Posted in Uncategorized

Tagged with , , , , , ,

A git log alias with colors, date and owner.

without comments

Written by tobi

March 11th, 2011 at 3:22 am

Posted in Uncategorized

Tagged with , , , , ,