Posts

Showing posts from April, 2013

Git tag and versioning your project

Image
We use tags to version our project. I will set up here basic commands we use on everyday basis and may use to handle some issues.
Showing your tags Listing the available tags in Git is straightforward. Just type git tag.
$ git tag 1.0.71.0.81.0.91.1.0
Adding tags To add tags you may do git tag tagname. But better to specify args to be able to use in scripts:
$ git tag -a 1.1.1-m "major improvements" $ git tag 1.0.71.0.81.0.91.1.01.1.1
Here we have added a tag version 1.1.1 with commit message "major improvements".
Uploading to repository I assume you have a GitHub repo. So to push your tags there run git push (for your tagged commits commits) and then push your tags:

$ git push Counting objects:120, done. Delta compression using up to 4 threads. Compressing objects:100% (59/59), done. Writing objects:100% (69/69),390.70 KiB, done. Total 69(delta 41), reused 0(delta 0) To ****************.git ******..****** master -> master $ git push --tags Counting objects:1,…

Django 1.5 migrating to new url tag syntax

Image
Django 1.5 changed. The url tag syntax from {% url  my_page %} into {% url "my_page" %}. Now all my templates should be changed accordingly to migrate to 1.5. You could do it with executing this command in your bash shell.
Assuming you are in the project folder. Assuming you have version control, or do know how to backup your work ;). Some people claim it is unsafe. But you may want to make it safer with adding '{%' to the beginning of the string. To make sure only templates arre changed. Or either execute this only in your templates folder to be sure.
$ find .-type f -print0 | xargs -0 sed -i 's/ url \([^" >][^ >]*\)/ url "\1"/g' And one person did a django snippet for this operation. You may also find it useful. http://djangosnippets.org/snippets/2905/