Git

Let's talk about the best version control system out there.

You know Git, right? If not, head here and get the gist of it. We will wait…

Ready? OK.

There are two main players in this field. GitHub and Bitbucket. When I started playing around with them I used their GUI apps (GitHub for Mac and SourceTree). These are great, but if you really want to know what is going on behind the curtain, they will unfortunately hide a lot of very interesting stuff from you.

Then you might end up with a question like this one: How the hell do I know, which project is pushed to GitHub and which one to Bitbucket?

Well, it’s quite simple. It’s all stored inside hidden .git directory which resides in the root of your project directory. There you will find what you are looking for.

Just cd to your Project directory and type:

You will get something like this:

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = [https://github.com/zavrelj/LearningGitHub.git](https://github.com/zavrelj/LearningGitHub.git) fetch = +refs/heads/*:refs/remotes/origin/*

And there it is — remote origin shows you where it is pushed. In this case it’s pushed to my repository on github.com server.

While this one:

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true [remote "origin"] url = [https://zavrelj@bitbucket.org/zavrelj/ds.git](https://zavrelj@bitbucket.org/zavrelj/ds.git) fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master

is pushed to my repository on bitbucket.org.

And this one:

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = true

hasn’t been pushed anywhere yet since I only locally created it by:

When you use GUI apps and add repository, they will update projects .git/config file and add their own remote origin. So if you want you repository on Bitbucket, just add it to Bitbucket app, if on GitHub, add it to GitHub app or, you can do it for every project manually like this:

git remote add origin [https://github.com/yourname/ProjectName](https://github.com/yourname/ProjectName)