M
M
Michael2016-10-20 23:05:06
git
Michael, 2016-10-20 23:05:06

How do you add commits?

I know that there is git-flow and other practices, but I don't really use them yet. If you need to do a lot of things in the project, then you have to throw everything off into 1 commit, because I can’t imagine how to commit every half hour for each feature. This only works well with edits.
Do you make frequent commits or "1 per workday"?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Igor Vorotnev, 2016-10-21
@HeadOnFire

Atomically. Often. Any coherent, complete and logical piece or piece, regardless of size. It doesn't matter if I drink myself or with a team. This is a matter of habit - at first you are lazy, and you don’t seem to see the point. Over time you get used to it. And when the time comes to take advantage of the charms of atomic commits (and it comes) - rolling back a feature or returning a previously rolled back one (at the request of the client), resolving conflicts, etc. - you rejoice and thank your past self for not being too lazy.
And yet, it is very important to write adequate commit messages. No "minor fix" and the like. According to the message, it should be clearly clear when scrolling through the history what's what and why, without having to look at the diff. Ideally, also binding to issues - but this is relevant in teamwork, one is not needed.
As for brunches, it depends a lot on the project. In teamwork, this is either feature branches (git flow or your own arbitrary scheme), or each has its own branch and do whatever you want there. Here the point is primarily in pull requests, code review, CI and a stable master, which always contains working code. If you work alone, I personally am used to branching each individual feature (not a fragment, but a module, an autonomous piece of functionality). It is convenient to checkout a specific branch on the servers, test, return to the master. And this allows you to work on several features at the same time. For example, I finished one, gave it to the client for approval, and there are comments / fixes, but you are waiting for some materials. Switched to another feature and work safely in another branch. In general, it is convenient and reliable.

A
ahosta, 2016-10-20
@ahosta

The idea of ​​GIT is just in meaningful commits
Stupid automatic commits once an hour - meaningless.
So that everyone doesn’t get smart: we have a software limitation for that - commits of more than 200 lines are not accepted.
But we really have a joint work and code review.
If you work without a team - do it as a backup. But this does not require GIT.
The idea of ​​GIT, so that you can UNDERSTAND why this or that crap was done.
And vice versa:
And to solve a certain problem, what kind of crap was done.

E
evnuh, 2016-10-20
@evnuh

Why do you need git at all if you don't use it? Simple backups are fine for you.

A
Alexey Shumkin, 2016-10-21
@ashumkin

If you need to do a lot of things in the project, then you have to throw everything into 1 commit,

there is no such thing as "a lot of things" there are sooo many things ..
each revision can / should be divided into small subtasks, commit them "separately", and then the entire branch (do you do revisions in separate branches?) merge into the main one --no-ff
with Igor Vorotnev can only add to what Igor Vorotnev said : for example, look at the same Git commits, a lot of developers are working on it, and there is a complete order with their design)) (only look not at merge commits, but those that are merged)) )

A
abcd0x00, 2016-10-26
@abcd0x00

Use
Then you can write something all day, and at the end of the day scatter it all over different commits.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question