Git posted by on December 6, 2013

Here I will write some stuff about Git DVCS…

=======================

I love git, git-gui and gitk, (almost) everything else is just annoying. Actually I don’t use the command line much, but I did in the beginning 2008… Most online tutorials for some reason avoid to even mention that git-gui and gitk exist although they are in Junio Hamano’s repo…

Having said that…
One useful command that i found somewhere is this one:
gitk –all $(git log -g –pretty=format:%h)
It will show the history including the unreferenced commits that would normally be hidden. So if you commit and then reset hard to an earlier point, the latest commits will be invisible and some people will think they are lost. This command will show you the commit and you can create a branches ponting to the commits you want to keep.
Put it in the tools in git-gui.

=======================

Recover changes that are not committed…
When you do a “git add” or move anything from the top left to the bottom left in git gui the content of the file is stored in a blob and the file content is possible to recover from that blob.

So it is possible to recover a file even if it was not committed but it has to have been added.

git init
echo hello >> test.txt
git add test.txt
Now the blob is created but it is referenced by the index so it will no be listed with git fsck until we reset. So we reset…

git reset –hard
git fsck
you will get a dangling blob ce013625030ba8dba906f756967f9e9ca394464a

git show ce01362
will give you the file content “hello” back

=======================

I use git for everything… including “large binary files”. Some people say it doesn’t work well, some people know it works well…

=======================

Price to “the most most unnecessary software of the century” goes to “github for xxx”. I tried to install it 4 times on Win7 with a month or so interval before it actually run (slowly)…
It is just there to stop you from using git with your non-github repositories and it doesn’t even do that part well…
It is very confusing even for me who has used git daily since 2008. I wonder how a beginner would feel…

Git, git-gui and gitk does everything so much better.

=======================

For my servers I usually use gitolite, which is an excellent piece of art, together with git-web.

=======================

Git Cheetah is really good also. It comes with the Git for windows by default. Use it!
If you use Nautilus you can install Git Cheetah from source very easily and it give you a right-click experience that makes things a lot easier.
Unfortunately the latest Mac version doesn’t work with Git Cheetah (as this is written) because Apple has screwed up…

=======================

Leave a Reply

Your email address will not be published. Required fields are marked *

forty four − forty two =