Question: Is there a way to make the tag name on acts\_as\_taggable\_on to be URL friendly?

For example, at the moment I have 'tags/foo' and 'tags/bar' working great. However when I add spaces to the name such as 'rabbits foot' the url is 'tags/rabbits%20foot'. I'd like to replace that %20 with a dash.

Thanks in advance!

**UPDATE**

I just noticed that stackoverflow actually uses a very similar or identical way of doing tags to what I have in mind.

Answer: 
1. First choose which commit you want everything to come after.

```
git reflog
5976f2b HEAD@{0}: commit: Fix conflicts
80e85a1 HEAD@{1}: commit: Add feature
b860ddb HEAD@{2}: commit: Add something

```
2. Reset to your selected head (I have chosen `HEAD@{2}`)

```
git reset b860ddb --soft

```
3. `git status` (just to be sure)
4. Add your new commit

```
git commit -m "Add new commit"

```

Note: `HEAD@{0}` & `HEAD@{1}` Are now merged into 1 commit, this can be done for multiple commits also.

`git reflog` again should display:

```
git reflog
5976f2b HEAD@{0}: commit: Add new commit
b860ddb HEAD@{1}: commit: Add something

```
**A Tool To Automate Multiple Commits Into One**

[as Kondal Kolipaka says](https://stackoverflow.com/a/13604550/12606887). Using "git rebase -i"

**The logic of "git rebase"**

When using "git rebase -i", git generates the git-rebase-todo file in the current .git/rebase-merge directory, and then invokes the git editor to let users edit the git-rebase-todo file for processing. So the tool needs to meet:

1. Modify the git editor to the tool which we provided;
2. The tool processes the git-rebase-todo file.

**Modify the default git editor**

```
git config core.editor #show current default git editor
git config --local --replace-all  core.editor NEW_EDITOR # set the local branch using NEW_EDITOR as git editor

```

So, the tool need change the git editor and process the git-rebase-todo file.
The tool using python below:

```
#!/usr/bin/env python3
#encoding: UTF-8

import os
import sys

def change_editor(current_file):
    os.system("git config --local --replace-all  core.editor " + current_file) # Set current_file as git editor
    os.system("git rebase -i") # execute the "git rebase -i" and will invoke the python file later with git-rebase-todo file as argument
    os.system("git config --local --replace-all core.editor vim") # after work reset the git editor to default

def rebase_commits(todo_file):
    with open(todo_file, "r+") as f:
        contents = f.read() # read git-rebase-todo's content
        contents = contents.split("\n")
        first_commit = True
        f.truncate()
        f.seek(0)
        for content in contents:
            if content.startswith("pick"):
                if first_commit:
                    first_commit = False
                else:
                    content = content.replace("pick", "squash") # replace the pick to squash except for the first pick
            f.write(content + "\n")

def main(args):
    if len(args) == 2:
        rebase_commits(args[1]) # process the git-rebase-todo
    else:
        change_editor(os.path.abspath(args[0])) # set git editor

if __name__ == "__main__":
    main(sys.argv)

```

Ref: <https://liwugang.github.io/2019/12/30/git_commits_en.html>