Report inadequate content

Git in Harecoded


Merging two, three or more git repositories keeping the log history

If you ask anyone, merging several git repositories into a single one would usually be considered a bad strategy: as a rule of thumb, your code base should have several components isolated and then use a dependency manager (e.g: Composer) to bring them together.

Nevertheless, there are always many different scenarios and with them come different use cases, weird situations...


Terminal tuning for Git developers in Mac

If you work with Git in the terminal there are some tweaks you might want to apply to your prompt for safer and faster coding. The following lines are part of my ~/.bash_profile file. I use it on Mac although that might work in Linux as well.

You can copy and paste this code in your ~/.bash_profile (create it if it doesn't exist), save and open a new terminal to see the...


Organizing git branches in logical folders

It is easier to find things when they are well organized. If you are a git user a good practice to name the branches would be to use descriptive names including slashes "/" (as in paths) where everything before the slash is the folder you want to use and then the logical name after it.

If you use the fantastic git graphical interface SourceTree (free for Windows and Mac)...


Migrating a Github repo to Bitbucket (or similar services)

Github is awesome. Bitbucket is awesome too. They are both excellent services, but Bitbucket has a plus: it's free for private repos.

That's one of the reasons on why we decided to stop paying our $25/mo Github account for small projects and moved to Bitbucket. Although the Bitbucket guys have now a one-click "import from Github tool", the solution is so simple that I don't...


Git log mejorado. Color y ramas dibujadas

Hace unos días me llegó un tweet de Dani con uno de esos regalos que hace de tanto en cuanto, que se acuerda de los amigos y te manda algo interesante. En este caso era un artículo en inglés de Filipe Kiss donde nos enseñaba como convertir el git log de terminal en algo con cara y ojos (hacer clic en imágen).

He modificado  el comando original para que muestre el...


Cómo borrar tags de Github

Si por ejemplo deseo borrar un tag llamado "1.0-stable-php-5.2"

Borro en local:

git tag -d 1.0-stable-php-5.2

Borro en el repositorio:

git push origin :1.0-stable-php-5.2

Atentos a los dos puntos delante del tag al hacer el push.

Actualización: He escrito el artículo dos veces, el original...


Cómo borrar un tag de GitHub u otro remoto

No resulta muy obvio cómo se pueden eliminar los tags de Github. Incluso hay algunos tutoriales por ahí que no funcionan. Estos son los dos comandos que utilizo yo únicamente para borrar los tags que pongo y quito en el proyecto de SIFO en Github.

El listado de tags del repositorio local se puede sacar fácilmente usando el comando git tag, por...


Cómo hacer un sparse checkout en Git

Si quieres hacer clone de un proyecto parcialmente y no llevarte todo el árbol es muy sencillo. Si todavía no tienes los ficheros es tan sencillo como:

Crear una carpeta e inicializar Git Activar sparse checkout Decirle qué carpetas queremos Añadir el repo remoto Traer los ficheros con pull Traducido en un ejemplo y sus comandos, pongamos que queremos ...


Move a SVN repository to Git with the whole commit history

It is in your mind, like a worm that eats away the apple, "I have to switch to Git". And one day it happens and you realize that it was not that diffcult.

I started using Git as my local repository, but still using SVN as the central repository with git itself thanks to the git svn set of commands. After some time I decided to entirely move the vast majority of projects from...


Upload an existing Git repository to a remote GitHub, Bitbucket, Beanstalk...

These are the steps I followed to upload my existing local git repository to a new Bitbucket repository while keeping the whole commit history. You can use this simple steps to move your source code to GitHub, Beanstalk or any other repository you like, commands are just the same. I put as example Bitbucket because you can have unlimited private repositories for free.