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