Adding and committing changes with git
With distributed version control systems such as git, you do most of your work with your local copy of the repository. You can add new code, change code, test, revise, and finally commit the fully tested code. This encourages frequent small commits on your local repository and one large commit when the code is stable.
How to do it...
The git add
command adds a change in your working code to the staging area. It does not change the repository, it just marks this change as one to be included with the next commit:
$ vim SomeFile.sh $ git add SomeFile.sh
Doing a git add
after every edit session is a good policy if you want to be certain you don't accidently leave out a change when you commit your changes.
You can also add new files to your repository with the git add command:
$ echo "my test file" >testfile.txt $ git add testfile.txt
Alternatively, you can add multiple files:
$ git add *.c
The git commit
command commits the changes to the repository:
...