Modern PHP, soft skills, productivity and time management.

Tag: git

Squash – simple way to cleaner git repository

I use git for about 3 years. First I knew only how to use it with PhpStorm – `cmd + t` to update branch, `cmd + k` to commit and push changes. To make new branch I used menu and let the IDE do the work. It was fine until I heard about `squash`. I heard that it is often used when you contribute to someone’s repository. Maintainer of the repo often want clean history – if you want to contribute you must make pull requests with only one commit. And you may do it using squash.

It was a bit too much for me at that time: `squash`, `rebase`, `push –force`. No thanks 😉

Some time later a couple of people in my company started to use git more. They started to make squashes, rebases and so on. So if they wanted to use it I had to learn it too.
Continue reading

A few words about Git hooks

Lets talk about Git hooks. You’re using Git, right? No? But… you have to! Seriously, go to git-scm, GitHub or whatever and check it out.

In Git you have 3 types of files: tracked, ignored and untracked.
Tracked ones are simple – they’re just files you’ve added to the repository. This might be your application’s code. Ignored ones are also simple – if you don’t want to have any file you can add it to `.gitignore` file and you will have it locally but not in the repository. This might be any vendors you can easily install and don’t need to store them in your repository.

But untracked files are a little bit more complicated. These are files you’ve just created and didn’t specify what to do with them. Are those useful and should be added, or are they just temporary files or vendors? They might be also autogenerated files and this post is really about them.
Continue reading

© 2024 Krzych Jończyk

Theme by Anders NorenUp ↑