Product docs and API reference are now on Akamai TechDocs.
Search product docs.
Search for “” in product docs.
Search API reference.
Search for “” in API reference.
Search Results
 results matching 
 results
No Results
Filters
How to Use Git the Version Control System
Traducciones al EspañolEstamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Git is a version control system that can be used to manage software projects. This guide’s six steps will show you how to initialize a Git repository, stage files for a commit, and commit these files to a local Git repository. For fuller instruction, refer to our more robust guide on Git Source Control Management .
Create a folder in which to store your files, then initialize a Git repository in that folder:
mkdir testgit cd testgit git init
Create files for Git to track, then append some text to a file:
touch file.txt file2.txt file3.txt echo "hello Linode" >> file.txt
Use
git status
to return information about the current Git repository:git status
On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) file.txt file2.txt file3.txt nothing added to commit but untracked files present (use "git add" to track)
Since
file.txt
contains text, you want Git to track any future changes to that file. Usegit add file.txt
to addfile.txt
to the list of files Git monitors. Typegit status
after the addition to confirm that Git is tracking the new file.git add file.txt git status
This will return:
On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: file.txt Untracked files: (use "git add <file>..." to include in what will be committed) file2.txt file3.txt
To commit the changes of
file.txt
to the version control system, usegit commit
. Git requires you to write a commit message, a message will help you remember the changes you have made to your files. In this example, use the-am
options to commita
ll modified files, specifically the ones Git is tracking, and include a commit message:git commit -am "Added Hello Linode to file.txt"
Git will return the following message, confirming your new changes:
[master (root-commit) e8cc496] added new file 1 file changed, 1 insertion(+) create mode 100644 file.txt
Track the remaining files in the directory using
git add -A
, and commit them with a message:git add -A git status
Returns:
On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: file.txt new file: file2.txt new file: file3.txt Now, commit the changes: git commit -am "The end!" [master 52a9240] The End 4 files changed, 1 insertion(+) create mode 100644 file1.txt create mode 100644 file2.txt create mode 100644 file3.txt
Note git add -A
,git add .
, andgit add -u
can all be used to stage files for a commit.git add -A
stagesa
ll of the files in the directory.git add .
stages only the new and modified files, omitting any deleted files.git add -u
stages only the modified and deleted files, omitting any new files.
More Information
You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.
This page was originally published on