I want to know what difference(or rather advantage) does GIT gives when doing local commits (commit command) as compared to just saving the changes in the working directory in SVN when working offline (not connected to server)
I have read that GIT gives an advantage of working offline i.e. user can perform commits locally as many times as he wants to and then when the user is connected to the server, (s)he can push the changes to remote server. I would like to know why is it advantageous if all commit command does is just committing to local disk which is again same as just saving your changes to the disk in SVN (when not connected with the server) and not committing to project branch.
I like GIT but I am not able to understand this difference. Please help !!
Thanks, Nayan
Scenario: You download the latest code from your repository onto your laptop before going offline (say for a long airplane journey).
On the flight you make some changes - you run units tests, run the code, everything seems to be working. You make some more changes - test them, things are still working. You get really enthusiastic and make a bunch more changes with some heavy re-factoring. You test the changes - everything's broken (e.g. because you made a bad assumption somewhere).
With SVN: Reverting the code to a working state is going to be tricky, because you can't remember how it looked before you started all that heavy refactoring. It'll likely involve a lot of tedious diffs between the code on your laptop and the master server whenever you get network access again. Meanwhile, you are stuck.
With Git: Assuming you were sensible and committed your changes to your local repository each time you knew it was in a working state, rolling back to the commit before you started that refactoring work is easy. You keep your valuable work and can start going down the right path straight away. When you get network access again you can push these changes to the master branch in one go and all will be well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With