Different ways of squashing commits

While creating a Pull Requests it’s good to squash all of our intermediate commits into one to avoid clutter in the git log, simplify analysis and allow for simple code revert when necessary. Solution #1 Some time ago I’ve found project http://rebaseandsqua.sh/ made by Jake Wharton. It’s really useful, handy and allows us to rebase and squash commits quite easily. We can just call: curl rebaseandsqua.sh | sh then edit our commit messages and push the changes....

July 21, 2018 · 3 min · 456 words · Piotr Wittchen

Avoiding merging master to master branch in Git

Problem If you are working with Git Version Control System, probably you have seen a commit messages in your git log like: Merge branch 'master' to 'master' or something similar. You might have even pushed such commits! Don’t worry, so did I ;-). In this article I’m going to explain why is it happenning and how to avoid it. Such situation happens when you performed changes locally and at the same time someone else performed changes on the same branch as well, commited and pushed them to the remote repository....

March 25, 2018 · 4 min · 647 words · Piotr Wittchen

Meet and Code 2017 - "Git – tips & tricks" presentation

Recently, during Meet & Code event organized by Media 3.0 and SAP Hybris, I’ve gave a talk for university and high-school students about basics of Git. Presentation was titled Git - tips & tricks and was organized at the Silesian Univeristy of Technology in the AEI Department where I was studying a few years ago. Presentation covered quite essential usage of Git, which could be helpful for people who are planning to learn it from the scratch....

October 21, 2017 · 1 min · 117 words · Piotr Wittchen

Review your changes in the code before the commit

Most of the people use git as follows. they create a feature branch they make some changes they add all the changes: git add -A they commit changes: git commit -m "I've done changes" they push it: git push There’s a problem with such approach. When we created a lot of changes, it may happen that we forgot to delete something and we pushed some garbage to the remote repository....

March 26, 2017 · 1 min · 207 words · Piotr Wittchen

My approach to Git aliases

While we are working with Version Control Systems like Git, it’s good to adapt them to our needs to perform daily work in a more productive way. People often create so-called Git aliases, which are shortcuts for longer commands. E.g. you can edit your .gitconfig file, which is usually located in your home directory and place a few aliases in the [alias] section. For example: [alias] ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate Then you can type: git ls in your Git repository to see pretty Git log....

March 12, 2017 · 3 min · 439 words · Piotr Wittchen