How to delete the commit history in github

Sometimes you may find deleting the commit history of your github project repository useful. You can easily delete the commit history by following the procedure below.

It is always useful to keep the backup of your repository in your computer before removing all the commit history.

Let us start by cloning a github project. I am cloning ‘myproject’, you clone yours.

$ git clone https://github.com/acsudeep/myproject.git

Since all the commit history are in the “.git” folder, we have to remove it. So, go inside your project folder. For me the project folder is ‘myproject’.

$ cd myproject

And delete the ‘.git folder’ with this command.

$ sudo rm -rf .git

Now, let us re-initialize the repository.

$ git init

$ git remote add origin https://github.com/acsudeep/myproject.git
# add remote url

$ git remote -v
# verify

Next, let us add all our files and commit the changes.

$ git add --all
$ git commit -am 'initial commit'

Now, since we just have one commit i.e ‘initial commit’. Let us force push update to our master branch of our project repository.

$ git push -f origin master

You may need to provide the credentials for your account.

Go and check your project repository in github, you should see only one commit.

Django Tutorial – Building URL Shortener with Django

I finally got the time to write a Django tutorial. In this tutorial we are building URL Shortener. If you are confused with what we are building then we are building something similar to (bit.ly) or (goo.gl).

We are building the app that will make a shorter URL of a longer URL. (Example) Normally the shorter URL will be localhost:8000/4hh5kr for http://www.facebook.com

I am using¬†Django 1.7.1 with Python 3.3.2+. Don’t worry if you have different version of Django because we will set up our virtual environment and install latest version of Django. But be sure you do have Python 3+ because installing Python will not be covered in this tutorial.

I assume that you have completed Writing your first Django app. It is not really essential to complete this tutorial but it is highly recommended that you complete this tutorial before we begin. It will give you a lot of knowledge that will be useful in this tutorial.

You can also get the source code of this app in Github(django_urlshortener).

This tutorial is divided into 5 parts:

Continue reading Django Tutorial – Building URL Shortener with Django