Agras Zeta Atino

Un blog mas de tecnologia, locuras y procrastinacion

Git repository from scratch | Creando un repositorio GIT desde cero

Just go to the end of the post if you dont wanna read all of it
So you’ve been playing with git, and you’ve already done the common thing:

$ git init
$ git add .
$ git commit

And then, you decide to upload your code somewhere else than github, gitorius or anywhat lets you use git (and where the workflow is: first create the repo, clone, then develop). That’s when you meet it, the hell… Its very annoying specially when you just want quick development, and what you really need is to start something, after you finish you decide to track the code, and then you see yourself in something like this:

$ mkdir ../myproject-new
$ cd ../myproject-new
$ git init
$ mv ../myproject/* .
$ git add .
$ git commit

And then, you meet the unconfortable truth, you dont have a bare rep to push your changes… so you kind of start over, to create a new repo so you can clone from it (although its empty) then add your files, commit and push… An easy way to do this would be like this:

Say you have a local branch, no other locations to pull from or to push to, your only working copy, and want to upload somewhere… before going into the git init|add|commit|clone|add origin hell just do this within your working copy:

git clone --bare $(pwd) git://server.com/path.git

And that’s it, this will create a new bare directory under the the path you specified… with no additional setup, and no madness. So you can ask your team members to just clone from server.com/path.git and that’s it… Painless

Facebook Twitter Email
Etiquetas: ,

Tu dirección de correo no será publicada. Los campos obligatorios están marcados con *

*

Social links powered by Ecreative Internet Marketing