Info
Open the page on your phone

How to add changes to Git?

To add changes to Git, you need to use the `git add` command. This command moves changes from the working directory to the staged files section. Staged files are the ones that will be included in the next commit.

The `git add` command takes one or more parameters that specify the paths to the files or directories that you want to add. If the parameter is a directory, the command adds all files in that directory recursively.

For example, to add changes to the file index.html, you can use the command:

                        
git add index.html

                        
                    

Or, to add changes to all files in the directory src, you can use the command:

                        
git add src

                        
                    

Once all changes have been staged, you can commit them to a commit using the `git commit` command.

Here is an example of how to add changes to Git:

                        
# Create a new file
echo "Hello, world!" > index.html

# Add the file to staged files
git add index.html

# Commit the changes to a commit
git commit -m "Add index.html"

                        
                    

These commands will create a new file `index.html`, add it to the staged files, and commit the changes to a commit with the message "Add index.html".