Ajmal Afif's blog

Balancing between consuming knowledge and creating values.

pushing local Git branch to Github

So today I worked on a local branch repo, and wanted to push my update to Github.

I Googled for reference and found this great article by Mario Pareja.

The only thing I would add on top of his piece is to step back and actually illustrate what’s origin.

So inside your repo;

1
$ git remote -v

should display your Github (or remote) repo that belongs to origin.

1
2
origin  [email protected]:[your-github-username]/bazaar.git (fetch)
origin  [email protected]:[your-github-username]/bazaar.git (push)

Pushing your local branch to Github (or remote repo)

Now how to push your local branch into your Github repo looks like;

1
$ git push origin [branch_name]

In my case, it was;

1
$ git push origin dev_gems

Mario added -u in between push and origin so that the next time he does git push, it’s gonna remember it as git push origin dev_gems.

Comments