Friday, February 25, 2011

Force FF not to fill up input by its 'memorized' state after refresh

If it is a very annoying thing for you, use autocomplete="off" for every input you want to avoid memorizing.

Wednesday, February 16, 2011

Patching with git diff

To create patch file:

git diff --no-prefix > filename

To apply it:

patch -p0 < filename

If you have a patch file that's been created without --no-prefix, apply it

patch -p1 < filename

Tuesday, February 15, 2011

Launch Virualbox image from command line

To launch a VirtualBox image directly without GUI interface do the following

vboxmanage startvm name

where name is exactly name is shown in VirtualBox GUI.

Git Delete Last Commit

Once in a while late at night when I ran out of coffee, I commit stuff that I shouldn't have. Then I spend the next 10 - 15 minutes googling how to remove the last commit I made. So after third time I wanted to make a record of it so I can refer to it later.

If you have committed junk but not pushed,

git reset --hard HEAD~1

HEAD~1 is a shorthand for the commit before head. Alternatively you can refer to the SHA-1 of the hash you want to reset to. Note that when using --hard any changes to tracked files in the working tree since the commit before head are lost.

If you don't want to wipe out the work you have done, you can use --soft option that will delete the commit but it will leave all your changed files "Changes to be committed", as git status would put it.

Now if you already pushed and someone pulled which is usually my case, you can't use git reset. You can however do a git revert,

git revert HEAD

This will create a new commit that reverses everything introduced by the accidental commit.

From here.

Thursday, February 10, 2011

Git support in Netbeans

To make Netbeans work with GIT as simple and comfortable as with Mercurial or SVN use nbgit.