Git Push & Delete Remote Branches

We all know that after we have finished with a certain feature branch in git, we can remove it easily by running the following command in shell:


git branch -d feature/branch-name

However, this only deletes this specific feature branch locally on your machine, and it does not remove the one sits on the server.

To delete the feature branch on the remote server, the syntax is a bit odd, but you will get used to it:


git push origin :feature/branch-name

That is, you still use “push” command, even though you are deleting it. And this command works with the “branch -d” command independently, so you need to run those two commands to remove both local and remote branches.

SourceTree 1.5.5 Quits Unexpectedly on Startup – Mac OS X 10.6.8

Today SourceTree detected an upgrade and asked me to install the newer version. I accepted and waited for it to open up so that I can continue working on it. However once upgrade finished, I kept getting this error, no matter how many times I tried:

I also tried to restart my Mac to see whether it makes any different, but without any luck.

After googling, I found the error people reported yesterday on Atlassian Answers. Looks like version 1.5.5 is no use for now, the easy solution is to get 1.5.4 version back from trash directory.

Should be careful next time when upgrading, I guess.

GIT “Broken Pipe” And “Out of Memory” Error When Pushing to Repository

Last week we spent some time migrating SVN to GIT in BitBucket, most of the processes was quite smooth, but we did encounter some errors while pushing some of our big repositories with lots of history into GIT. We got the following error:

error: RPC failed; result=55, HTTP code = 0
fatal: The remote end hung up unexpectedly

This is due to the fact that we are pushing too much data that exceeds git’s http post buffer which is defined in the doc as:

Maximum size in bytes of the buffer used by smart HTTP transports when POSTing data to the remote system. For requests larger than this buffer size, HTTP/1.1 and Transfer-Encoding: chunked is used to avoid creating a massive pack file locally. Default is 1 MiB, which is sufficient for most requests.

. The fix was quite straightforward, simply fire the following command on you shell:

git config http.postBuffer 524288000

This allows GIT to send up-to 500MB of data to the server, if the error still returns, try to increase this value until it can go through. Of course you need to be aware of how much memory your system has before it will crash.

Remember to reset the value back to its original value, or some value that is more common in everyday commits, according to the docs that I mentioned  above, it is 1MB by default. I forgot to reset the value after my initial imports to GIT and my subsequent commits resulted the following out of memory error:

git-remote-https(52011,0x7fff7011acc0) malloc: *** mmap(size=18446744071938875392) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
git-remote-https(52011,0x7fff7011acc0) malloc: *** mmap(size=18446744071938875392) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
fatal: Out of memory, malloc failed (tried to allocate 18446744071938872320 bytes)

even though I only push a small change to the GIT server, I am not exactly sure why, but reset the value should resolve the issue:

git config http.postBuffer 5242880

I use 5MB just in case.

SVN to GIT migration Using svn2git

We already had plans to migrate SVN to GIT for a while now in EM, but we just never found a chance to do it. Last week we had a major outrage in our Primus data center, which hosts all our development tools, including JIRA, SVN, Bamboo, and all the VM machines for development purposes.

The outrage took quite a few days to recover, and as a result,  our head of engineering decided to migrate all our  SVN repository to GIT in BitBucket.

The tool we used is called svn2git, it provides very easy command line tool for us to check out all the files under a repository, and then import all histories into GIT in no time, well, depends on the size of your repository of course.

This tool provides several features that allow you to include either tags or branches, or simply only trunk, and also allow you to exclude some files based on regular expression patterns. It is quite a handy tool for this kind of migration. Sample commands includes:

svn2git http://svn.example.com/path/to/repo
svn2git http://svn.example.com/path/to/repo --trunk dev --tags rel --nobranches
svn2git http://svn.example.com/path/to/repo --trunk trunk --nobranches --notags
svn2git http://svn.example.com/path/to/repo --rootistrunk
svn2git http://svn.example.com/path/to/repo --exclude doc --exclude '.*~$'
svn2git http://svn.example.com/path/to/repo/nested_project --no-minimize-url

For further installation and usage instructions, please refer to their github home page.