A
A
alexandrnevajno12018-01-28 11:57:28
git
alexandrnevajno1, 2018-01-28 11:57:28

Git - please explain why you came up with add? Why it was impossible to do immediately commit (Without add)?

I'm just starting to learn Git, so I don't get it. Tell.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
Decadal, 2018-01-28
@Decadal

because you won't always want to add all the files that have changed. Often you need to add some.
Example: you were viewing some file, accidentally put a space there. Git status showed 4 changed files, although you are sure of only 3. Then you add three files and freely commit them, and then deal with the fourth.
Especially vital for hotfixes, when there is no time to deal with something, you just need to upload one file with a fix.

V
Vitaly, 2018-01-28
@vt4a2h

Why not just read the documentation? It is even in Russian: https://git-scm.com/book/ru/v1/%D0%92%D0%B2%D0%B5%... . Immediately many questions will disappear. After all, such questions are often from ignorance of history and misunderstanding of the technology itself.

L
Leonid, 2018-01-28
@zzevaka

Why not? Can. git commit -a.
Let's say you fixed some bug in the code and added a new icon at the same time. These changes you want to spread across different commits for clarity. To do this, you can separately add the necessary files for different commits.

X
xtala zen, 2018-01-28
@xtala

A commit is a record of changes to a repository, i.e. an action that changes the history of a project. And add is adding a file (or part of it) under version control once, to include a file or part of it for writing in the next commit two (this command has several purposes, it is universal). The repository can contain both controlled files (tracked) and untracked (any garbage for example). For the convenience of recording commits, you can use the command $ git commit -am "имя коммита"(where the "a" flag means adding all previously tracked files to the commit, and the "m" flag means that the commit name is specified in the input line, and not in an external editor, such as vim ) dangled underfoot and did not pop up in tooltips for untracked files; it is listed in the file.gitignore

M
Maxim Fedorov, 2018-01-28
@Maksclub

Why specify in the address field who to send the email to?
Let after writing the letter go to everyone who is in the address book ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question