Posts for: #Git

git-vim

I have had an item on my todo list to improve my [vim/git]{tag/vimgit} integration for a while. Today, I found git-vim on github. I was really impressed. So I forked it and hope to do some work on the project…

    git://git.jukie.net/git-vim.git

First I will have to check if there is anything salvageable from my current vim scripts.

Read more →

color your word

I just discovered a [git]{tag/git} feature that has eluded me since v1.4.3, when it was introduced. It’s a way to colour differing words in git diff output. Maybe you don’t know about it either… allow me demonstrate:

Read more →

show current git branch on zsh prompt (2)

NOTE: This post has been [updated]{zsh-git-prompt} (again).

I previously wrote about [showing the git branch name on the zsh prompt]{zsh-git-branch}. Caio Marcelo pointed out that it didn’t work very well because the git branch was being queried before the command was executed, and it should be after to catch git commands that change the branch, like git branch and git checkout.

He was right, here is a repost.

Read more →

how to track multiple svn branches in git

I must say that I am no fan of [SVN]{tag/svn}, but SVN and I get a long a lot better since I started using git-svn. Long ago a good friend of mine, Dave O’Neill, taught me how to handle multiple branches using git-svn. I had used that technique until Dave taught me how to do it better.

Recently I saw this blog post which referenced Dave’s article talking about the first method. I guess Dave never got around to updating his blog with the better way. So I am going to do that here:

Read more →

show current git branch in zsh

NOTE: This post has been [updated]{zsh-git-branch2}.

Earlier today I saw a blog post titled “Git in your prompt” which showed how to get the current git branch to display in zsh and bash. I tried it on my setup and found it really slow, probably due having $HOME on NFS or having big git repos or maybe not enough ram.

Anyway, after looking at some zsh docs and blog posts, I had added caching to the idea. Now the git-branch is only queried on a directory change or on a command that matches *git*.

Read more →

svn status like output in git

Today Dave asked me how to get a script-friendly list of untracked files, and modified files… like svn status.

First I suggested that he look at --diff-filter and --name-status options for git-diff.

    git diff --name-status --diff-filter=M

While git-diff can actually report a lot of cool stuff (see the git-diff-files man page for more details), it did not solve all the problems. The above worked for getting the list of modified files, but not for untracked files. We scratched our heads and were unable to get anywhere.

Read more →

git-svnup

My employer (or client, since I am a contractor there) uses [svn]{tag/svn}. I prefer to use [git]{tag/git}.

This following git allows me to update all tracked svn branches in my git-svn repository:

    git config --get alias.svnup
    !git-config --get-regexp 'svn-remote.*url' | cut -d . -f 2 | xargs -n1 git-svn fetch

The way to invoke it is to run:

    git svnup
    git-svn rebase some-remote-snv-branch

You need to put that into your ~/.gitconfig like so:

Read more →