Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this how you normally would use SVN or GIt?

In all the tutorials I see of using SVN or Git, they always show them updating individual files. I may work on 100 files in 1 day, is it normal to work on many files and at the end of the day, just do 1 commit for all the files instead of doing each file individually that I modify?

like image 583
JasonDavis Avatar asked Jan 21 '10 20:01

JasonDavis


People also ask

Should I use SVN or Git?

SVN is better than Git for architecture performance, binary files, and usability. And it may be better for access control and auditability, based on your needs.

What is the use of Git and SVN?

The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.

What is Git or SVN?

The difference between Git and SVN version control systems is that Git is a distributed version control system, whereas SVN is a centralized version control system. Git uses multiple repositories including a centralized repository and server, as well as some local repositories.

Where is SVN used?

It is an open-source tool for version control. SVN is used to manage the current and previous versions of files like source code, documentation, and files. It acts as the time machine for the developers and allows them to go back and browse the history of the project.


3 Answers

You generally want to group commits into logically related changes, all with one commit message.

You should always commit working code; don't commit something that's half done and breaks the build, which could also break someone who's trying to find out which commit introduced a bug by testing older versions. Each commit should contain a small set of changes that are all related to each other.

I wouldn't recommend batching up all of your changes for the day into one commit. If you need to look through the history later on, it will be hard to find the change you need if an entire day's work is crammed together into one commit. If you need to revert a change, it's best if you can revert an entire commit, instead of having to selectively revert a file at a time.

Of course, on some days, you will have a complicated change that takes an entire day to create; in that case, if it's all one logical change, then do one commit at the end of the day. Be reasonable, there are no absolute rules here.

like image 124
Brian Campbell Avatar answered Nov 11 '22 13:11

Brian Campbell


I typically break it down into units of work. If modifying all 100 files accomplished one unit of work check it all in together at the end of the day. But it's more likely that you touched 5 or 10 files for one task, then 20 files for another, etc., etc. I would recommend performing a check in for each of those. If for no other reason, your check in notes will be more accurate and more useful.

like image 45
Matthew Vines Avatar answered Nov 11 '22 14:11

Matthew Vines


It's normal, but sometimes smaller commits are better than commit only at the end of day. If you are working with a big team and you commit only at the end of the day you probably will have conflicts when you update (before the commit).

Smaller commits are better when you and your team do code review too. So, you commit only 5, 10 files and the reviewer will review the code more easily. If you commit 100 files the reviewer will have much more work.

like image 27
Pedro Ghilardi Avatar answered Nov 11 '22 14:11

Pedro Ghilardi