Tag: git

Create Clean Branch in Git

Normally, whenever you create a new branch, you need the original branch and then you branch them. The problem is, they have a parent branch. The commit history from the original branch will be carried to your new branch too. This is intentional and not the git issue. That how git branch supposed to be work.

SourceTree new Branch

Normally, you don’t need to create a completely new branch. Rather, you create a new repository. It new project anyway, so it best to use a different repository. Or maybe just change it gradually.

But, sometimes you need or want to create a completely new branch without any parent but still in the same repository. For whatever your reason is.

You may don’t know this yet, but git has a command to checkout new branch without any parent. It called the orphan branch. With this command, you can create a completly new branch and its root won’t have any connection to the other branch. But it will still have previous files in the repository directory. Don’t worry about that, you can remove it later after the checkout process is done.

So in short, what you want to do is to create a new orphan branch, clear the file and remove file history and then add the new file for your new project. Here is how to do it.

First, create a new orphan branch. It has the same command as git checkout but with the --orphan parameter.

git checkout --orphan <newbranch>

Second, you want to remove any old file in the repository directory. Either you delete it using file explorer, command or by any method you prefer. If you are using git rm command, it may look like this.

git rm --cached -r .

Dot “.” character at the end of the command is intentional. That mean it will remove any files from the current directory which is your repository directory. -r parameter mean is it will remove recursively to ensure any files is deleted.

And that it. Simple right?

If you have any further question or suggestion, you can ask me in the comment bellow. Thank you for reading!

Yes, you can use GIT for one-man project

My friend looking at my application project (for undergraduate thesis)

Friend: You use git?

Me: Yeah, why?

Friend: You work with other people too?

Me: No, I’m alone.

Friend: Then why you use git?

Me: ლ(ಠ益ಠლ)

This is a pretty weird conversation.

Seriously. When you talk to someone and they are not on the same page as you, it can be pretty awkward.

I don’t know why most of my friends think that when you use git, you must be working with a team. Maybe this is because, on usual practice, they didn’t really use git that much. Maybe only use them when the prof told you to or working on a team project.

For me, I always use it. Always.

I really love Git or you can say version control. This really saves me from a lot of trouble like making a backup, losing a project, revert to the old version, manage codebase (like when I need to know when I change that line of code), etc etc.

I know that most people say that the most powerful thing git can do are code sharing, working on the same project with a lot of people. But, since we need other feature too, why not use it. I mean, maybe in the future, you will change your mind and want to make your personal project as open source.

Maybe some of you asking “Isn’t git too overkill? Maybe svn is enough.”

Not really. First of all, you don’t need to setup remote git server in GitHub or Bitbucket or hosting server of your choice. Just use > git init and ta da… your repository is created. And there is no need to add fancy stuff like branch or folder structure for branching.

So, its okay to use git for a personal project. And it’s fine even if you want it to be forever private. It’s better than lose your 200 hours of work. Better safe than sorry.

Bitbucket vs Github

So, my friends have been bugging me, asking me this all the time.

  • Github? Bitbucket? What the differences?
  • Unlimited/many private repo hosting service?
  • Best git hosting service? Github or Bitbucket?
  • Git = Github? (What?)

These question has been asked a lot, so in this post, I  will clear all of them once and for all.

To answer that question, the first thing you should know is that git isn’t same with github. Git is version control which is a small program that manages your codebase, and github is git hosting service where you can put your git repository online so your friend or people can access it via the internet. So, they are different.

The second is that when you asking what is “the best”? My answer is always “depends”. To make it clear, it depends on what your need. To understand that, you need to know both feature hosting service provide us. But I won’t post any feature they add that doesn’t really have any connection with git.


Probably my most used repository.


Bitbucket, similar to Github, gives us ability to host our git repository on the internet. But it’s not only support git, you can use mercurial too in Bitbucket.

Bitbucket also offering unlimited private repository. So, you can make many private repos as much as you want.

But there is a limit. Maximus repository size allowed is 2GB per repository, this is a hard limit. Also, there is a soft limit about 1GB. You will only get an email warning about your repository being too huge from Bitbucket but you still can add more file to it until 2GB is reached. So if your repository is almost 2GB, it’s better to decrease your repository size. If you reach 2GB, your repository will be disabled until your repository is back under the limit.

I hardly ever encounter repository this big. If your repository is this big then you may have been wrong using git.

Also, if you need more people in your project, you can subscribe to Bitbucket as low as $10 which will give you 10 collaborators in 1 team. Here is the price I got from Bitbucket web page:

bitbucket pricing
Well, free is enough for me.

But as long as you keep your team up to 5 users, then you don’t really need to pay/subscribe.

Quick Recap:

  • Unlimited Public Repository
  • Unlimited Private Repository
  • Max 5 Collaborators on Free Account
  • Max repo size: 2GB (1GB soft limit)
  • Support Git and Mercurial
  • Offer more collaborators with price, $1 per person


On another hand, github take open-source like project approach where your repository is shared with people as many as possible.


They give us unlimited repository, unlimited collaborators, but no private repository on free account.

Same with Bitbucket, github also has repository limit 1GB. Smaller than bitbucket, I know. But seriously. If your repository is this big, then you may using git wrong. Github also has maximum file size, 100MB each but you will got a warning when you commit 50MB file.

Github also can support git LFS so if you are working with large files, this is really great news. It’s pain to share binary file before this.

But if it’s not enough, you can subscribe to it to gain more like more private repository, more LFS storage, etc. It start from $7 a month for personal plans, and if you want organization plan then it start from $25 a month. Here are the price I got from Github:


Quick Recap:

  • Unlimited Public Repository
  • Unlimited Collaborators
  • No private repository on free account
  • Support Git LFS
  • Max 1GB repostiry size
  • Max 100MB file size, 50MB soft limit
  • Offer subscribtion for private repository


They both has offer many great feature, and that why my answer to the previous question is depend on what you really need.

If you want to have private repository for free, but doesn’t really work with many people, then I recommend you to using Bitbucket.

If you want to work with as many people as possible, but doesn’t really care about public or private repo, or even want it to be public repository, then I recommend you to using Github.

I hope this will clear all your question or confusion about which hosting service you want to use. If you want to ask more or add any suggestion, you can ask me in the comment section bellow. Cheers.

Bitbucket Graph Statistic

If you often working on Github then want to Bitbucket because some reason, maybe you miss the Github statistic like how many commits, contributor statistic, graph, etc. Well, you are not alone.

Github Graph


Many people seem to think the same way that Bitbucket need some statistic so we can manage repository better, like Github. Maybe you just want to see how many commit, or want to see Activity Time, or just want to see a nice graph of your repository. Whatever your reason is, I think Bitbucket can improve it service by adding some statistic to a repository.

There is workaround thought, we can use Bitbucket Add-On to add some nice beautiful graph to a repository. The addon name is Awsome Graphs, and it add some graph and statistic to your repository, just like Github.

Bitbucket Graph

Here is how:

  1. Visit your Account add on or click here.
  2. Find AddOn Awesome Graphs, and click “Add” button.
  3. Refresh your repository if you open it in Browser.

That it, easy right. With this, there will at least some statistic to help you manage your repository.

Want to see it in Action?


Account Add-On – [Link]

Bitbucket Blog – [Link]

SourceTree, Best Git Client

Today, I want to do a bit of a review to one of my favorite Git Client, SourceTree, made by Atlassian which is a company that makes an online productivity service such as Bitbucket, Jira and many more if you already know it. There’s a reason why I love SourceTree so much that it become an essential application on my computer, its pity though it doesn’t available on Linux. Here are some of them:


It Provides GUI

What is this? 90′?

Unlike the traditional way of using git, using command line tools, SourceTree provides us with easy to use GUI (Graphical User Interface) so you don’t have to remember the syntax to do something. Don’t worry, there is nothing wrong with using a command line. But for new user, especially if they are new in Version Control world. It may easier for them to using GUI based app.

We can see any essential thing in git repository really fast like commit, unstaged files, branch, tag, and more in a single glance without clicking anything.

Common Git Command is in Front

An essential command such as commit, pull, push, create a branch, and merge is displayed right in the front so if you want to do some git command then you can just click on the icon. And if you want to do advance command or the git command you want to do isn’t available in the GUI, there is terminal you can use easily so you can type your own git command on it.


And if you think moving your hand to keyboard and mouse often is annoying, there’s a shortcut you can use.

Oh, and it adds it own feature (non-git feature) like Git Flow for Workflow. So if you are using Git Workflow on your project, it will help you doing any branching, tagging workflow manually.

Windows, Mac OS X support

It supports Windows and Mac OS X so if you are working on that platform like me, you definitely can use this application. But it doesn’t support Linux. It’s a bit a downfall but not feature breaking and Linux user usually already comfortable using a command line tools anyway.

It Git Client, not Github or Bitbucket client

It’s not specific online Git Service such as Github or Bitbucket client. Rather, it was Git Client so if you are using other online Git Service you can still use SourceTree to manage your repository. But if you are using Github and Bitbucket, it can list all your remote repository on your account.


As you can see in the example above, it list all of my remote repositories stored on Github and Bitbucket. Don’t worry, there’s no work repository here so my secret/work project isn’t displayed. 🙂

Maybe that all feature I like on SourceTree and why I love using this application for now. It has more great feature but what I describe above is what I like and useful to me on SourceTree. Like mercurial support, SourceTree support Mercurial but since I don’t really use mercurial so it doesn’t really useful to me.

If you are interested, why not check it and give it a try? I will provide the link bellow.

SourceTree – [Official Website]


Why you should use Version Control?

My friend asking me why I’m using Version Control even if I’m working alone. It seems that for some new developer, version control like Git or SVN only for people that work in a team. In their mind, Version Control is only for this purpose and no other.

Well, in some sense they are not wrong. It’s like saying notes is only for taking notes. It’s true, but it’s not completely correct either. You can use notes for many other things, like write a diary, to do list, scribbling, etc. It’s only matter of use. Different people can use the same thing for the different thing.

But if you only know using Version Control for team development, here are some of useful thing you can do:

File Backup with Versioning

Have you ever make changes to a file and want to revert back? I already modify x file 6 times, but I want to revert back to file when it was still 3 times changed. Or maybe lost your code but your backup is too old? With Version Control, not only you can backup your files but it mark your changes too.

What more, you can compare the difference between the version of your code.

Your project has multiple version

Often in some project I work on like cashier application, I support multiple version of my project for a different company. Mostly they are similar, but they want a bit change to the code to fulfill their needs. Or brochure project you make for a client and the client asking you to make a several and similar version of the brochure. You can use Git branching for this, and it would be easier to manage the project.

Let you doing experimental changes

I often want to make a feature I like to add, but I’m not sure if it can be used or fit my system. I can just change my code, but I carrying risk my application being broken by my changes. Which is usually will break my application or at least introduce a bug.

With version control, you can just change them as you like, if it broke and want to change your mind, just revert it back to last working version. Or you can use a branch for that. Create a branch, make changes, if it broke remove the branch, if working merge the branch. Simple right?

Of course it not limited to these, you can use Version Control as you like. I always telling my friends to use Version Control to minimize the risk when they are working on their project. Nothing to lose right.

If you have more idea to use version control, feel free to tell me how you use version control for. Or if you haven’t convinced yet, you can ask me for more use of version control via comment bellow.