Question: I had a master branch. And I started to work on a feature on this branch (I forgot to create separate branch and to play on this branch). Before I came to the end of feature implementation, I had a dozen on commits to master with dummy names etc... And now I would like to push this feature to my master origin. But I don't want to push whole commits history. Is there a way to "rollback" intermediate from git log?

Answer: 
Since you have 12 commits it will probably be fastest to do 

```
git reset --soft @{u}
git commit -m "YOUR COMMIT MESSAGE"
git push

```

This will squash an arbitrary number of commits without you having to do anything on a per-commit basis.
What you want to do is `squash` your commits together. Suppose you made 10 commits since you started; then you will do:

```
git rebase -i HEAD~10

```

* -i : interactive rebasing
* HEAD~10 : starting from the 10th commit before the current one (HEAD)

now you will be in an editor with a line for each commit. You should replace the words `pick`. For the first line you will type `edit` (so you can change the commit message), for all the others `fixup` (or `f`). Thus all the latter commits will be squashed into the first one; and the commit message will be removed (so only the commit message you edited will remain).

So the file you are editing should look like this:

```
edit  2fa588e start of devel
fixup c420848 bugfix
f     78c41af bugfix
f     6bff2f0 bugfix blah blah

```