Skip navigation

Tag Archives: utility belt

I’ve been using command-line git for about a year now. I recently decided to tackle my problem of not knowing how to delete remote branches.

I’ve pushed quite a few branches to some remote repos as a means of transporting projects to/from home/work. As a result there are quite a few useless branches in most of my git projects and it makes working with

git branch -a

more cumbersome than it need be.

In searching for an answer, I actually found out that it is much simpler than I had anticipated. Very similar to what I was already doing to push the branch to the remote repo.

git push origin :<branchname>

That’s it! I just have to add a colon to the remote branch name and git deletes it. Not at all intuitive, but very easy to remember.

I despise working with file paths in Java. I can never remember where, in the project’s folder structure, the jvm considers root. And it gets even more complicated once you start running your applications in a server container. However, I did find a quick way to determine where a running JVM considers root.

import java.io.File;

...

File f = new File("dummy");
 _log.info("file is at " + f.getAbsolutePath());

This should print out the absolute path to where this File object would be saved. You can use this as a starting point and do any sort of relative filepathing you need to from here.

%d bloggers like this: