Answer the question
In order to leave comments, you need to log in
At what point in the program should an initial commit be made?
Hello, I recently started learning Git, a question arose that I could not find the answer to on google (maybe I'm just bad at google).
When you start developing an application, can you immediately create a repository for it (for example, a public one on GitHub)?
Let me explain: the project has just been created, during the development process code will be written, commits will be made, while there is still no full-fledged working version of the program. Those. a person who visits github and sees the project will not be able to use it, since it is not ready yet. Perhaps you should indicate in README.md that the project is under development?
Earlier we were talking about a private project, now, let's say I want to develop some kind of product together with other programmers. HereI read about the development model with master and develop branches, again, in this case, can you make the first commit when you have the first working version, or immediately at the start of development?
I would like to hear a detailed answer why this is so (or a link to the article). Thank you all in advance.
Answer the question
In order to leave comments, you need to log in
Git keeps a history of changes. Whether you committed the code you currently have into it or not is completely irrelevant. The main thing is to commit the code that you are going to change into it. To have a copy of it before the changes.
As long as you're writing new code, you don't need version control. As soon as you need to fix something in the code, you must first make a commit so that if the fix fails, do not remember exactly what and how it was fixed, but return to the previous version of the code or visually compare it with the current one.
By the time the code does at least something, you will most likely have more than a dozen commits. Don't be afraid to create an unnecessary commit - only the ones you need are important, and how many others there are is completely uncritical.
The usual practice is to make a feature, commit the code with the comment "made this feature". Fixed a bug - similar. At the same time, you can also see the history of work later;)
Do what is convenient and expedient for you. I would make commits from the very beginning of the project.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question