Git micro commits

Apr 12, 2015

Probably many of you have used Git, or SVN or both. If you didn’t use them then give Git a try and forget SVN, it will make your life easier. You can find the most popular git cloud repositories at GitHub and BitBucket. I’m not gonna waste your time with what is Git or SVN, you can read yourself and figure it out.

Now why I choose to compare micro commits vs large commits? Well, until recently I used a piece of software built on SVN. When it launched, probably was a very hot tool to use, but as time passes other tools come around and this one doesn’t satisfy your needs at full. Using SVN for a few years now I couldn’t branch. The tool had the option to branch but it was a nightmare to use it so instead of ruining the whole repository I choose not to use it. So basically I was forced to commit and push only after my code was done, tested and fully functional. Imagine working a week, or even more, adding more and more stuff to your solution and push everything into one massive chunk of code. For me it was a nightmare as if any of the code me or my team were pushing might need removal you have to remove the entire push. This is the story for mega commits.

Recently I decided to use git for my final year project. Some reasons behind this decisions involved a good branching system, more grained control over your code and your work and very easy rollback in case of mistakes. Usage of a new system came with the specific learning curve and after I got used with using it I forgot about the old SVN system. What is interesting is that when you learn a similar technology you tend to use your old habits with it and not be aware of some of the advantages. This happened to me as even having all the advantages of git I kept commiting and pushing after all the work has been done. While working on my Android project I had a git issue that involved adding activities, classes, creating data models and changing other existing ones so I started to commit after each change. For example when I added a class, an activity or an xml file I commited. Then I realized that this is a more efficient way to commit my work as I could see better commit messages and cherry pick commits. Also my commit messages are more specific and my final one will close the GitHub issue I was working on.

This is one day of work:

image

The tool I use to manage my repositories is called SourceTree and is free.

Tags: programminggit

Archives

  1. February 2024
  2. Maximizing Software Development Productivity: The Power of Flow and Minimizing Interruptions
  3. December 2023
  4. Clean Code in Java: Writing Code that Speaks
  5. Clean Code in Java: A concise guide
  6. Understanding Value Objects in Java: A Brief Guide
  7. August 2023
  8. Consuming RabbitMQ Messages with Clojure: A Step-by-Step Tutorial with Tests
  9. January 2023
  10. Running a Spring Boot service with kubernetes
  11. December 2022
  12. Hosting a PWA with Jekyll and Github pages
  13. November 2022
  14. Global Day of Code Retreat
  15. Facilitating a mini Code Retreat
  16. October 2022
  17. The Curse of Optional
  18. September 2022
  19. Testing Spring Boot Microservices - Presentation
  20. March 2022
  21. TDD Workshop
  22. February 2022
  23. Value Objects in Java
  24. Efficient Java
  25. January 2022
  26. Spring Boot testing - Focus on your changes
  27. Product users - Personas
  28. December 2021
  29. Write code fit for testing
  30. November 2020
  31. Running a Spring Boot app with kubernetes
  32. September 2019
  33. Setup GPG on Mac and sign git repositories
  34. July 2019
  35. Running a Clojure Pedestal application on Raspberry Pi model B revision 2
  36. Clojure from zero to hero (part 3) - First endpoint
  37. Clojure from zero to hero (part 2) - A bit of syntax
  38. June 2019
  39. Clojure from zero to hero (1) - explaining project.clj
  40. Clojure from zero to hero (0) - creating a Pedestal app
  41. November 2017
  42. Introduction to Docker
  43. April 2015
  44. Git micro commits
  45. July 2014
  46. Google Glass Development - setup tools, environment and turn on debugging on Glass
  47. June 2013
  48. How To: Get the rendered HTML of a webpage with Python
  49. Set union of two lists in Python